def test_verify_repository(self): self.lb.find_container_repositories.return_value = [ ContainerRepository({ "repository": "foo/bar", "release_categories": ["Generally Available"], "published": True, "auto_rebuild_tags": ["latest"] }) ] self.lb.find_images_with_included_rpms.return_value = [ ContainerImage({ "brew": { "build": "foo-1-1" }, "content_sets": ["content-set"], "repositories": [ { "registry": "registry.example.com", "published": True, "repository": "foo/bar", "tags": [{ "name": "1" }, { "name": "latest" }, { "name": "1-1" }], }, { "registry": "registry.build.example.com", "published": False, "repository": "buildsys/foobar", "tags": [{ "name": "1-1" }, { "name": "1.old" }], }, ] }) ] ret = self.verifier.verify_repository("foo/bar") expected = { "repository": { "auto_rebuild_tags": ["latest"] }, "images": { "foo-1-1": { "content_sets": ["content-set"], "tags": ["1", "latest", "1-1"] } }, } self.assertEqual(ret, expected)
def test_get_verify_image(self): self.lb.find_container_repositories.return_value = [ ContainerRepository({ "repository": "foo/bar", "release_categories": ["Generally Available"], "published": True, "auto_rebuild_tags": ["latest"] }) ] self.lb.get_images_by_nvrs.return_value = [ ContainerImage({ "brew": {"build": "foo-1-1"}, "content_sets": ["content-set"] }) ] ret = self.verifier.verify_image("foo-1-1") self.assertEqual(ret, {"foo-1-1": ["content-set"]})
def test_verify_repository_no_content_sets(self): self.lb.find_container_repositories.return_value = [ ContainerRepository({ "repository": "foo/bar", "release_categories": ["Generally Available"], "published": True, "auto_rebuild_tags": ["latest"] }) ] self.lb.find_images_with_included_srpms.return_value = [ ContainerImage({ "brew": {"build": "foo-1-1"}, "content_sets": [] }) ] self.assertRaisesRegex( ValueError, r'.*are not set for this image.', self.verifier.verify_repository, "foo/bar")