diff --git a/tests/apitests/python/library/repository.py b/tests/apitests/python/library/repository.py index 96d77aa0a..1b2b7569b 100644 --- a/tests/apitests/python/library/repository.py +++ b/tests/apitests/python/library/repository.py @@ -11,12 +11,6 @@ def pull_harbor_image(registry, username, password, image, tag, expected_error_m time.sleep(2) _docker_api.docker_image_pull(r'{}/{}'.format(registry, image), tag = tag, expected_error_message = expected_error_message) -def pull_harbor_image_successfully(registry, username, password, image, tag): - pull_harbor_image(registry, username, password, image, tag) - -def pull_harbor_image_unsuccessfully(registry, username, password, image, tag, expected_error_message): - pull_harbor_image(registry, username, password, image, tag, expected_error_message = expected_error_message) - def push_image_to_project(project_name, registry, username, password, image, tag): _docker_api = DockerAPI() _docker_api.docker_login(registry, username, password) diff --git a/tests/apitests/python/test_project_level_policy_content_trust.py b/tests/apitests/python/test_project_level_policy_content_trust.py index 4e38c1c29..8d9afb1eb 100644 --- a/tests/apitests/python/test_project_level_policy_content_trust.py +++ b/tests/apitests/python/test_project_level_policy_content_trust.py @@ -10,8 +10,7 @@ from library.project import Project from library.user import User from library.repository import Repository from library.repository import push_image_to_project -from library.repository import pull_harbor_image_successfully -from library.repository import pull_harbor_image_unsuccessfully +from library.repository import pull_harbor_image class TestProjects(unittest.TestCase): @classmethod @@ -77,13 +76,13 @@ class TestProjects(unittest.TestCase): self.repo.image_should_exist(TestProjects.repo_name, tag, **TestProjects.USER_CONTENT_TRUST_CLIENT) #5. Pull image(IA) successfully; - pull_harbor_image_successfully(harbor_server, admin_name, admin_password, TestProjects.repo_name, tag) + pull_harbor_image(harbor_server, admin_name, admin_password, TestProjects.repo_name, tag) #6. Enable content trust in project(PA) configuration; self.project.update_project(TestProjects.project_content_trust_id, metadata = {"enable_content_trust": "true"}, **TestProjects.USER_CONTENT_TRUST_CLIENT) #7. Pull image(IA) failed and the reason is "The image is not signed in Notary". - pull_harbor_image_unsuccessfully(harbor_server, admin_name, admin_password, TestProjects.repo_name, tag, "The image is not signed in Notary") + pull_harbor_image(harbor_server, admin_name, admin_password, TestProjects.repo_name, tag, expected_error_message = "The image is not signed in Notary") if __name__ == '__main__': unittest.main()