harbor/tests/apitests/python/testutils.py
danfengliu 1979d17550 add tc add-sys-label-to-tag and del-repo
Signed-off-by: danfengliu <danfengl@vmware.com>
2018-11-02 17:16:43 +08:00

25 lines
738 B
Python

import time
import os
import sys
sys.path.append(os.environ["SWAGGER_CLIENT_PATH"])
from swagger_client.rest import ApiException
import swagger_client.models
from pprint import pprint
harbor_server = os.environ["HARBOR_HOST"]
CLIENT=dict(endpoint="https://"+harbor_server+"/api")
USER_ROLE=dict(admin=0,normal=1)
TEARDOWN = True
def GetProductApi(username, password, harbor_server= os.environ["HARBOR_HOST"]):
cfg = swagger_client.Configuration()
cfg.host = "https://"+harbor_server+"/api"
cfg.username = username
cfg.password = password
cfg.verify_ssl = False
cfg.debug = True
api_client = swagger_client.ApiClient(cfg)
api_instance = swagger_client.ProductsApi(api_client)
return api_instance