-
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.
- Loading branch information
Showing
4 changed files
with
59 additions
and
0 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,47 @@ | ||
"""Tests that perform actions over packages.""" | ||
from uuid import uuid4 | ||
|
||
from pulp_deb.tests.functional.constants import DEB_PACKAGE_RELPATH | ||
from pulp_deb.tests.functional.utils import ( | ||
get_local_package_absolute_path, | ||
get_local_duplicate_package_absolute_path, | ||
) | ||
|
||
|
||
def test_upload_package_and_duplicate( | ||
deb_get_repository_by_href, | ||
deb_package_factory, | ||
deb_repository_factory, | ||
): | ||
"""Test whether uploading a structured package works and creates the correct paths.""" | ||
attrs = { | ||
"file": get_local_package_absolute_path(DEB_PACKAGE_RELPATH), | ||
"relative_path": DEB_PACKAGE_RELPATH, | ||
"distribution": str(uuid4()), | ||
"component": str(uuid4()), | ||
} | ||
|
||
repository = deb_repository_factory() | ||
assert repository.latest_version_href.endswith("/0/") | ||
repository_href = repository.pulp_href | ||
attrs["repository"] = repository_href | ||
|
||
deb_package_factory(**attrs) | ||
repository = deb_get_repository_by_href(repository_href) | ||
assert repository.latest_version_href.endswith("/1/") | ||
# TODO: Assert the added content counts on the new repo version! | ||
|
||
attrs["file"] = get_local_duplicate_package_absolute_path(DEB_PACKAGE_RELPATH) | ||
deb_package_factory(**attrs) | ||
repository = deb_get_repository_by_href(repository_href) | ||
assert repository.latest_version_href.endswith("/2/") | ||
# TODO: Assert the added and removed content counts on the new repo version! | ||
|
||
|
||
# TODO: Add a second test for the following workflow: | ||
# NAME=duplicate-upload-test | ||
# PACAKGE_HREF_1=$(pulp deb content upload --file=frigg_1.0_ppc64.deb | jq -r .pulp_href) | ||
# PACAKGE_HREF_2=$(pulp deb content upload --file=duplicates/frigg_1.0_ppc64.deb | jq -r .pulp_href) | ||
# pulp deb repository create --name=${NAME} | ||
# pulp deb repository content modify --repository=${NAME} \ | ||
# --add-content "[{\"pulp_href\": \"${PACAKGE_HREF_1}\"}, {\"pulp_href\": \"${PACAKGE_HREF_2}\"}]" |
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 @@ | ||
This is a duplicate of the package with a different checksum! |
Binary file added
BIN
+2.07 KB
pulp_deb/tests/functional/data/packages/duplicates/frigg_1.0_ppc64.deb
Binary file not shown.
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