mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-29 21:54:13 +01:00
Modify script call create project (#6263)
Signed-off-by: danfengliu <danfengl@vmware.com>
This commit is contained in:
parent
205a658afb
commit
6289275118
@ -44,7 +44,7 @@ class TestProjects(unittest.TestCase):
|
|||||||
USER_001_CLIENT=dict(endpoint = url, username = user_001_name, password = user_001_password)
|
USER_001_CLIENT=dict(endpoint = url, username = user_001_name, password = user_001_password)
|
||||||
|
|
||||||
#2. Create private project-001
|
#2. Create private project-001
|
||||||
project_001_name, project_001_id = self.project.create_project(metadata = {"public": "false"}, **ADMIN_CLIENT)
|
project_001_id, project_001_name = self.project.create_project(metadata = {"public": "false"}, **ADMIN_CLIENT)
|
||||||
self.assertNotEqual(project_001_name, None, msg="Project was created failed, return project name is {} and id is {}.".format(project_001_name, project_001_id))
|
self.assertNotEqual(project_001_name, None, msg="Project was created failed, return project name is {} and id is {}.".format(project_001_name, project_001_id))
|
||||||
|
|
||||||
#3.1 Get private projects of user-001
|
#3.1 Get private projects of user-001
|
||||||
|
@ -46,7 +46,7 @@ class TestProjects(unittest.TestCase):
|
|||||||
def testAddSysLabelToRepo(self):
|
def testAddSysLabelToRepo(self):
|
||||||
"""
|
"""
|
||||||
Test case:
|
Test case:
|
||||||
Delete a repository
|
Add Replication Rule
|
||||||
Test step & Expectation:
|
Test step & Expectation:
|
||||||
1. Create a new user(UA);
|
1. Create a new user(UA);
|
||||||
2. Create a new private project(PA) by user(UA);
|
2. Create a new private project(PA) by user(UA);
|
||||||
@ -71,7 +71,7 @@ class TestProjects(unittest.TestCase):
|
|||||||
TestProjects.USER_add_rule_CLIENT=dict(endpoint = url, username = user_add_rule_name, password = user_add_rule_password)
|
TestProjects.USER_add_rule_CLIENT=dict(endpoint = url, username = user_add_rule_name, password = user_add_rule_password)
|
||||||
|
|
||||||
#2.1. Create private project(PA) by user(UA)
|
#2.1. Create private project(PA) by user(UA)
|
||||||
_, TestProjects.project_add_rule_id = self.project.create_project(metadata = {"public": "false"}, **TestProjects.USER_add_rule_CLIENT)
|
TestProjects.project_add_rule_id, _ = self.project.create_project(metadata = {"public": "false"}, **TestProjects.USER_add_rule_CLIENT)
|
||||||
|
|
||||||
#2.2. Get private project of uesr-001, uesr-001 can see only one private project which is project-001
|
#2.2. Get private project of uesr-001, uesr-001 can see only one private project which is project-001
|
||||||
self.project.projects_should_exist(dict(public=False), expected_count = 1,
|
self.project.projects_should_exist(dict(public=False), expected_count = 1,
|
||||||
|
@ -46,12 +46,12 @@ class TestProjects(unittest.TestCase):
|
|||||||
def testAddSysLabelToRepo(self):
|
def testAddSysLabelToRepo(self):
|
||||||
"""
|
"""
|
||||||
Test case:
|
Test case:
|
||||||
Delete a repository
|
Add Global Label To Tag
|
||||||
Test step & Expectation:
|
Test step & Expectation:
|
||||||
1. Create a new user(UA);
|
1. Create a new user(UA);
|
||||||
2. Create a new private project(PA) by user(UA);
|
2. Create a new private project(PA) by user(UA);
|
||||||
3. Add user(UA) as a member of project(PA) with project-admin role;
|
3. Add user(UA) as a member of project(PA) with project-admin role;
|
||||||
4. Get private project of uesr-001, uesr-001 can see only one private project which is project-001;
|
4. Get private project of user(UA), user(UA) can see only one private project which is project(PA);
|
||||||
5. Create a new repository(RA) and tag(TA) in project(PA) by user(UA);
|
5. Create a new repository(RA) and tag(TA) in project(PA) by user(UA);
|
||||||
6. Create a new label(LA) in project(PA) by admin;;
|
6. Create a new label(LA) in project(PA) by admin;;
|
||||||
7. Add this system global label to repository(RA)/tag(TA);
|
7. Add this system global label to repository(RA)/tag(TA);
|
||||||
@ -73,12 +73,12 @@ class TestProjects(unittest.TestCase):
|
|||||||
TestProjects.USER_add_g_lbl_CLIENT=dict(endpoint = url, username = user_add_g_lbl_name, password = user_001_password)
|
TestProjects.USER_add_g_lbl_CLIENT=dict(endpoint = url, username = user_add_g_lbl_name, password = user_001_password)
|
||||||
|
|
||||||
#2. Create private project-001
|
#2. Create private project-001
|
||||||
project_add_g_lbl_name, TestProjects.project_add_g_lbl_id = self.project.create_project(metadata = {"public": "false"}, **TestProjects.ADMIN_CLIENT)
|
TestProjects.project_add_g_lbl_id, project_add_g_lbl_name = self.project.create_project(metadata = {"public": "false"}, **TestProjects.ADMIN_CLIENT)
|
||||||
|
|
||||||
#3. Add user-001 as a member of project-001 with project-admin role
|
#3. Add user-001 as a member of project-001 with project-admin role
|
||||||
self.project.add_project_members(TestProjects.project_add_g_lbl_id, TestProjects.user_add_g_lbl_id, **TestProjects.ADMIN_CLIENT)
|
self.project.add_project_members(TestProjects.project_add_g_lbl_id, TestProjects.user_add_g_lbl_id, **TestProjects.ADMIN_CLIENT)
|
||||||
|
|
||||||
#4. Get private project of uesr-001, uesr-001 can see only one private project which is project-001
|
#4. Get private project of user(UA), user(UA) can see only one private project which is project(PA);
|
||||||
self.project.projects_should_exist(dict(public=False), expected_count = 1,
|
self.project.projects_should_exist(dict(public=False), expected_count = 1,
|
||||||
expected_project_id = TestProjects.project_add_g_lbl_id, **TestProjects.USER_add_g_lbl_CLIENT)
|
expected_project_id = TestProjects.project_add_g_lbl_id, **TestProjects.USER_add_g_lbl_CLIENT)
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ class TestProjects(unittest.TestCase):
|
|||||||
TestProjects.USER_del_repo_CLIENT=dict(endpoint = url, username = user_del_repo_name, password = user_del_repo_password)
|
TestProjects.USER_del_repo_CLIENT=dict(endpoint = url, username = user_del_repo_name, password = user_del_repo_password)
|
||||||
|
|
||||||
#2. Create a new project(PA) by user(UA);
|
#2. Create a new project(PA) by user(UA);
|
||||||
project_del_repo_name, TestProjects.project_del_repo_id = self.project.create_project(metadata = {"public": "false"}, **TestProjects.USER_del_repo_CLIENT)
|
TestProjects.project_del_repo_id, project_del_repo_name = self.project.create_project(metadata = {"public": "false"}, **TestProjects.USER_del_repo_CLIENT)
|
||||||
|
|
||||||
#3. Create a new repository(RA) in project(PA) by user(UA);
|
#3. Create a new repository(RA) in project(PA) by user(UA);
|
||||||
repo_name, _ = create_repository(project_del_repo_name, harbor_server, 'admin', 'Harbor12345', "hello-world", "latest")
|
repo_name, _ = create_repository(project_del_repo_name, harbor_server, 'admin', 'Harbor12345', "hello-world", "latest")
|
||||||
|
Loading…
Reference in New Issue
Block a user