Skip to content

Commit

Permalink
Fix test for initial repo version
Browse files Browse the repository at this point in the history
closes #5757

(cherry picked from commit 8320562)
  • Loading branch information
David Davis authored and ipanova committed Nov 22, 2019
1 parent ebade22 commit c910d5c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES/5757.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix tests for initial repo version change.
1 change: 0 additions & 1 deletion functest_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
ecdsa~=0.13.2
git+https://github.com/PulpQE/pulp-smash.git#egg=pulp-smash
pyjwkest~=1.4.0
pulpcore~=3.0rc7
8 changes: 5 additions & 3 deletions pulp_container/tests/functional/api/test_recursive_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def test_missing_repository_argument(self):

def test_empty_source_repository(self):
"""Ensure exception is raised when source_repository does not have latest version."""
self.client.delete(self.to_repo['latest_version_href'])
with self.assertRaises(HTTPError) as context:
self.client.post(
self.CONTAINER_MANIFEST_COPY_PATH,
Expand Down Expand Up @@ -223,7 +224,7 @@ def test_copy_by_digest_with_incorrect_media_type(self):
)
latest_to_repo_href = self.client.get(self.to_repo['pulp_href'])['latest_version_href']
# Assert no version created
self.assertIsNone(latest_to_repo_href)
self.assertEqual(latest_to_repo_href, f"{self.to_repo['pulp_href']}versions/0/")

def test_copy_multiple_manifests_by_digest(self):
"""Specify digests to copy."""
Expand Down Expand Up @@ -263,7 +264,7 @@ def test_copy_manifests_by_digest_empty_list(self):
)
latest_to_repo_href = self.client.get(self.to_repo['pulp_href'])['latest_version_href']
# Assert a new version was not created
self.assertIsNone(latest_to_repo_href)
self.assertEqual(latest_to_repo_href, f"{self.to_repo['pulp_href']}versions/0/")


class TestTagCopy(unittest.TestCase):
Expand Down Expand Up @@ -300,6 +301,7 @@ def test_missing_repository_argument(self):

def test_empty_source_repository(self):
"""Ensure exception is raised when source_repository does not have latest version."""
self.client.delete(self.to_repo['latest_version_href'])
with self.assertRaises(HTTPError):
self.client.post(
self.CONTAINER_TAG_COPY_PATH,
Expand Down Expand Up @@ -387,7 +389,7 @@ def test_copy_tags_by_name_empty_list(self):
)
latest_to_repo_href = self.client.get(self.to_repo['pulp_href'])['latest_version_href']
# Assert a new version was not created
self.assertIsNone(latest_to_repo_href)
self.assertEqual(latest_to_repo_href, f"{self.to_repo['pulp_href']}versions/0/")

def test_copy_tags_with_conflicting_names(self):
"""If tag names are already present in a repository, the conflicting tags are removed."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_repository_only_no_latest_version(self):
"""Do not create a new version, when there is nothing to remove."""
self.client.post(self.CONTAINER_RECURSIVE_REMOVE_PATH)
latest_version_href = self.client.get(self.to_repo['pulp_href'])['latest_version_href']
self.assertIsNone(latest_version_href)
self.assertEqual(latest_version_href, f"{self.to_repo['pulp_href']}versions/0/")

def test_remove_everything(self):
"""Add a manifest and its related blobs."""
Expand Down
2 changes: 1 addition & 1 deletion pulp_container/tests/functional/api/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_sync(self):
self.addCleanup(self.client.delete, remote['pulp_href'])

# Sync the repository.
self.assertIsNone(repo['latest_version_href'])
self.assertEqual(repo["latest_version_href"], f"{repo['pulp_href']}versions/0/")
sync(self.cfg, remote, repo)
repo = self.client.get(repo['pulp_href'])
self.assertIsNotNone(repo['latest_version_href'])
Expand Down

0 comments on commit c910d5c

Please sign in to comment.