diff --git a/tests/apitests/python/test_list_helm_charts.py b/tests/apitests/python/test_list_helm_charts.py index e6fd4e59c..0ae2a3fc8 100644 --- a/tests/apitests/python/test_list_helm_charts.py +++ b/tests/apitests/python/test_list_helm_charts.py @@ -2,7 +2,7 @@ from __future__ import absolute_import import unittest -from testutils import ADMIN_CLIENT +from testutils import ADMIN_CLIENT, CHART_API_CLIENT from testutils import TEARDOWN from library.user import User from library.project import Project @@ -27,7 +27,7 @@ class TestProjects(unittest.TestCase): @unittest.skipIf(TEARDOWN == False, "Test data won't be erased.") def test_ClearData(self): #1. Delete chart file; - self.chart.delete_chart_with_version(TestProjects.project_chart_name, TestProjects.CHART_NAME, TestProjects.VERSION, **ADMIN_CLIENT) + self.chart.delete_chart_with_version(TestProjects.project_chart_name, TestProjects.CHART_NAME, TestProjects.VERSION, **CHART_API_CLIENT) #2. Delete project(PA); self.project.delete_project(TestProjects.project_chart_id, **TestProjects.USER_CHART_CLIENT) @@ -50,8 +50,8 @@ class TestProjects(unittest.TestCase): 3. Delete user(UA). """ url = ADMIN_CLIENT["endpoint"] - - user_chart_password = "Aa123456" + chart_api_url = CHART_API_CLIENT['endpoint'] + user_chart_password = 'Aa123456' TestProjects.CHART_NAME = 'mariadb' TestProjects.VERSION = '4.3.1' @@ -60,14 +60,16 @@ class TestProjects(unittest.TestCase): TestProjects.USER_CHART_CLIENT=dict(endpoint = url, username = user_chart_name, password = user_chart_password) + TestProjects.API_CHART_CLIENT=dict(endpoint = chart_api_url, username = user_chart_name, password = user_chart_password) + #2. Create a new project(PA) by user(UA); TestProjects.project_chart_id, TestProjects.project_chart_name = self.project.create_project(metadata = {"public": "false"}, **TestProjects.USER_CHART_CLIENT) #3. Upload a chart file to project(PA); - self.chart.upload_chart(TestProjects.project_chart_name, r'./tests/apitests/python/mariadb-{}.tgz'.format(TestProjects.VERSION), **TestProjects.USER_CHART_CLIENT) + self.chart.upload_chart(TestProjects.project_chart_name, r'./tests/apitests/python/mariadb-{}.tgz'.format(TestProjects.VERSION), **TestProjects.API_CHART_CLIENT) #4. Chart file should be exist in project(PA). - self.chart.chart_should_exist(TestProjects.project_chart_name, TestProjects.CHART_NAME, **TestProjects.USER_CHART_CLIENT) + self.chart.chart_should_exist(TestProjects.project_chart_name, TestProjects.CHART_NAME, **TestProjects.API_CHART_CLIENT) if __name__ == '__main__': unittest.main() \ No newline at end of file diff --git a/tests/apitests/python/testutils.py b/tests/apitests/python/testutils.py index aff96ad07..14fb16bd7 100644 --- a/tests/apitests/python/testutils.py +++ b/tests/apitests/python/testutils.py @@ -14,6 +14,7 @@ admin_pwd = "Harbor12345" harbor_server = os.environ["HARBOR_HOST"] #CLIENT=dict(endpoint="https://"+harbor_server+"/api") ADMIN_CLIENT=dict(endpoint = os.environ.get("HARBOR_HOST_SCHEMA", "https")+ "://"+harbor_server+"/api/v2.0", username = admin_user, password = admin_pwd) +CHART_API_CLIENT=dict(endpoint = os.environ.get("HARBOR_HOST_SCHEMA", "https")+ "://"+harbor_server+"/api", username = admin_user, password = admin_pwd) USER_ROLE=dict(admin=0,normal=1) TEARDOWN = os.environ.get('TEARDOWN', 'true').lower() in ('true', 'yes')