mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-03 14:37:44 +01:00
Fix API TEST for chart Version
Fix api test for chart b/c revert the api Signed-off-by: DQ <dengq@vmware.com>
This commit is contained in:
parent
6216073d2a
commit
cd69339014
@ -2,7 +2,7 @@ from __future__ import absolute_import
|
|||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from testutils import ADMIN_CLIENT
|
from testutils import ADMIN_CLIENT, CHART_API_CLIENT
|
||||||
from testutils import TEARDOWN
|
from testutils import TEARDOWN
|
||||||
from library.user import User
|
from library.user import User
|
||||||
from library.project import Project
|
from library.project import Project
|
||||||
@ -27,7 +27,7 @@ class TestProjects(unittest.TestCase):
|
|||||||
@unittest.skipIf(TEARDOWN == False, "Test data won't be erased.")
|
@unittest.skipIf(TEARDOWN == False, "Test data won't be erased.")
|
||||||
def test_ClearData(self):
|
def test_ClearData(self):
|
||||||
#1. Delete chart file;
|
#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);
|
#2. Delete project(PA);
|
||||||
self.project.delete_project(TestProjects.project_chart_id, **TestProjects.USER_CHART_CLIENT)
|
self.project.delete_project(TestProjects.project_chart_id, **TestProjects.USER_CHART_CLIENT)
|
||||||
@ -50,8 +50,8 @@ class TestProjects(unittest.TestCase):
|
|||||||
3. Delete user(UA).
|
3. Delete user(UA).
|
||||||
"""
|
"""
|
||||||
url = ADMIN_CLIENT["endpoint"]
|
url = ADMIN_CLIENT["endpoint"]
|
||||||
|
chart_api_url = CHART_API_CLIENT['endpoint']
|
||||||
user_chart_password = "Aa123456"
|
user_chart_password = 'Aa123456'
|
||||||
TestProjects.CHART_NAME = 'mariadb'
|
TestProjects.CHART_NAME = 'mariadb'
|
||||||
TestProjects.VERSION = '4.3.1'
|
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.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);
|
#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)
|
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);
|
#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).
|
#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__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
@ -14,6 +14,7 @@ admin_pwd = "Harbor12345"
|
|||||||
harbor_server = os.environ["HARBOR_HOST"]
|
harbor_server = os.environ["HARBOR_HOST"]
|
||||||
#CLIENT=dict(endpoint="https://"+harbor_server+"/api")
|
#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)
|
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)
|
USER_ROLE=dict(admin=0,normal=1)
|
||||||
TEARDOWN = os.environ.get('TEARDOWN', 'true').lower() in ('true', 'yes')
|
TEARDOWN = os.environ.get('TEARDOWN', 'true').lower() in ('true', 'yes')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user