mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 02:35:17 +01:00
Remove 2 redundant functions, pull_harbor_image_successfully and pull_harbor_image_unsuccessfully.
Signed-off-by: danfengliu <danfengl@vmware.com>
This commit is contained in:
parent
3356368bff
commit
7c57864c99
@ -11,12 +11,6 @@ def pull_harbor_image(registry, username, password, image, tag, expected_error_m
|
|||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
_docker_api.docker_image_pull(r'{}/{}'.format(registry, image), tag = tag, expected_error_message = expected_error_message)
|
_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):
|
def push_image_to_project(project_name, registry, username, password, image, tag):
|
||||||
_docker_api = DockerAPI()
|
_docker_api = DockerAPI()
|
||||||
_docker_api.docker_login(registry, username, password)
|
_docker_api.docker_login(registry, username, password)
|
||||||
|
@ -10,8 +10,7 @@ from library.project import Project
|
|||||||
from library.user import User
|
from library.user import User
|
||||||
from library.repository import Repository
|
from library.repository import Repository
|
||||||
from library.repository import push_image_to_project
|
from library.repository import push_image_to_project
|
||||||
from library.repository import pull_harbor_image_successfully
|
from library.repository import pull_harbor_image
|
||||||
from library.repository import pull_harbor_image_unsuccessfully
|
|
||||||
|
|
||||||
class TestProjects(unittest.TestCase):
|
class TestProjects(unittest.TestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -77,13 +76,13 @@ class TestProjects(unittest.TestCase):
|
|||||||
self.repo.image_should_exist(TestProjects.repo_name, tag, **TestProjects.USER_CONTENT_TRUST_CLIENT)
|
self.repo.image_should_exist(TestProjects.repo_name, tag, **TestProjects.USER_CONTENT_TRUST_CLIENT)
|
||||||
|
|
||||||
#5. Pull image(IA) successfully;
|
#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;
|
#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)
|
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".
|
#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__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user