-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[noissue]
- Loading branch information
Showing
2 changed files
with
104 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import pytest | ||
|
||
from pulp_deb.tests.functional.constants import DEB_FIXTURE_SINGLE_DIST, DEB_FIXTURE_UPDATE_REPOSITORY_NAME | ||
|
||
|
||
@pytest.fixture | ||
def deb_content_filters_init(deb_init_and_sync): | ||
|
||
def _deb_content_filters_init(): | ||
remote_args = {"distributions": DEB_FIXTURE_SINGLE_DIST} | ||
repo, _ = deb_init_and_sync(remote_args=remote_args) | ||
repo_v1_href = repo.latest_version_href | ||
assert repo_v1_href.endswith("/1/") | ||
|
||
repo, _ = deb_init_and_sync( | ||
repository=repo, | ||
url=DEB_FIXTURE_UPDATE_REPOSITORY_NAME, | ||
remote_args=remote_args | ||
) | ||
repo_v2_href = repo.latest_version_href | ||
assert repo_v2_href.endswith("/2/") | ||
return (repo, repo_v1_href, repo_v2_href) | ||
|
||
return _deb_content_filters_init | ||
|
||
|
||
@pytest.fixture | ||
def deb_content_filters_get_hrefs(apt_release_api, apt_release_component_api): | ||
|
||
def _deb_content_filters_get_hrefs(repo_version_href, component): | ||
releases = apt_release_api.list(repository_version=repo_version_href) | ||
release_href = releases.results[0].pulp_href | ||
release_components = apt_release_component_api.list(repository_version=repo_version_href) | ||
rc = [x for x in release_components.results if x.component == component] | ||
rc_href = rc[0].pulp_href | ||
return (release_href, rc_href) | ||
|
||
return _deb_content_filters_get_hrefs | ||
|
||
@pytest.mark.parallel | ||
def test_content_filters( | ||
deb_content_filters_init, | ||
deb_content_filters_get_hrefs, | ||
apt_package_api, | ||
apt_release_api, | ||
apt_release_component_api | ||
): | ||
repo, repo_v1_href, repo_v2_href = deb_content_filters_init() | ||
assert repo_v1_href.endswith("/1/") | ||
assert repo_v2_href.endswith("/2/") | ||
|
||
release_href, rc_href = deb_content_filters_get_hrefs(repo_v2_href, "asgard") | ||
|
||
assert apt_package_api.list(release=f"{release_href},{repo_v1_href}").count == 4 | ||
assert apt_package_api.list(release=f"{release_href},{repo_v2_href}").count == 6 | ||
assert apt_package_api.list(release=f"{release_href},{repo.pulp_href}").count == 6 | ||
|
||
assert apt_package_api.list(release_component=f"{rc_href},{repo_v1_href}").count == 3 | ||
assert apt_package_api.list(release_component=f"{rc_href},{repo_v2_href}").count == 5 | ||
packages = apt_package_api.list(release_component=f"{rc_href},{repo.pulp_href}") | ||
assert packages.count == 5 | ||
|
||
package_href = [x for x in packages.results if x.package == "heimdallr"][0].pulp_href | ||
|
||
assert apt_release_api.list(package=f"{package_href},{repo_v1_href}").count == 0 | ||
assert apt_release_api.list(package=f"{package_href},{repo_v2_href}").count == 1 | ||
assert apt_release_api.list(package=f"{package_href},{repo.pulp_href}").count == 1 | ||
|
||
assert apt_release_component_api.list(package=f"{package_href},{repo_v1_href}").count == 0 | ||
assert apt_release_component_api.list(package=f"{package_href},{repo_v2_href}").count == 1 | ||
assert apt_release_component_api.list(package=f"{package_href},{repo.pulp_href}").count == 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters