From 9178ba11382395c4e6c484d29cfd221d64af491e Mon Sep 17 00:00:00 2001 From: Yang Jiao Date: Wed, 20 Oct 2021 10:08:43 +0800 Subject: [PATCH] Fix issues in python api test Signed-off-by: Yang Jiao --- tests/apitests/python/library/containerd.py | 1 - tests/apitests/python/library/docker_api.py | 4 ---- tests/apitests/python/library/robot.py | 1 - tests/robot-cases/Group3-Upgrade/prepare.py | 4 ---- 4 files changed, 10 deletions(-) diff --git a/tests/apitests/python/library/containerd.py b/tests/apitests/python/library/containerd.py index ef8f83d49..d74abd3a6 100644 --- a/tests/apitests/python/library/containerd.py +++ b/tests/apitests/python/library/containerd.py @@ -6,7 +6,6 @@ import docker_api def ctr_images_pull(username, password, oci): command = ["ctr", "images", "pull","--snapshotter", "native", "-u", username+":"+password, oci] - print("Command: ", command) ret = base.run_command(command) print("Command return: ", ret) diff --git a/tests/apitests/python/library/docker_api.py b/tests/apitests/python/library/docker_api.py index ad10d7527..20899b546 100644 --- a/tests/apitests/python/library/docker_api.py +++ b/tests/apitests/python/library/docker_api.py @@ -23,7 +23,6 @@ def docker_login_cmd(harbor_host, username, password, cfg_file = "./tests/apites print("[Warnig]: No docker credential was provided.") return command = ["docker", "login", harbor_host, "-u", username, "-p", password] - print( "Docker Login Command: ", command) base.run_command(command) if enable_manifest == True: try: @@ -79,7 +78,6 @@ def list_repositories(harbor_host, username, password, n = None, last = None): command = ["curl", "-s", "-u", username+":"+password, "https://"+harbor_host+"/v2/_catalog"+"?n=%d"%n, "--insecure"] else: command = ["curl", "-s", "-u", username+":"+password, "https://"+harbor_host+"/v2/_catalog", "--insecure"] - print( "List Repositories Command: ", command) ret = base.run_command(command) repos = json.loads(ret).get("repositories","") return repos @@ -91,7 +89,6 @@ def list_image_tags(harbor_host, repository, username, password, n = None, last command = ["curl", "-s", "-u", username+":"+password, "https://"+harbor_host+"/v2/"+repository+"/tags/list"+"?n=%d"%n, "--insecure"] else: command = ["curl", "-s", "-u", username+":"+password, "https://"+harbor_host+"/v2/"+repository+"/tags/list", "--insecure"] - print( "List Image Tags Command: ", command) ret = base.run_command(command) tags = json.loads(ret).get("tags","") return tags @@ -112,7 +109,6 @@ class DockerAPI(object): if registry == "docker": registry = None try: - print("Docker login: {}:{}:{}".format(registry,username,password)) ret = self.DCLIENT.login(registry = registry, username=username, password=password) except Exception as err: print( "Docker image pull catch exception:", str(err)) diff --git a/tests/apitests/python/library/robot.py b/tests/apitests/python/library/robot.py index 291c29bfd..3ef9b9d11 100644 --- a/tests/apitests/python/library/robot.py +++ b/tests/apitests/python/library/robot.py @@ -118,7 +118,6 @@ class Robot(base.Base, object): robot_desc = base._random_name("robot_desc") robotAccountCreate = v2_swagger_client.RobotCreate(name=robot_name, description=robot_desc, duration=duration, level="system", disable = False, permissions = permission_list) - print("robotAccountCreate:", robotAccountCreate) data = [] data, status_code, header = self._get_client(**kwargs).create_robot_with_http_info(robotAccountCreate) base._assert_status_code(expect_status_code, status_code) diff --git a/tests/robot-cases/Group3-Upgrade/prepare.py b/tests/robot-cases/Group3-Upgrade/prepare.py index 51ae4b6a1..569ed126e 100644 --- a/tests/robot-cases/Group3-Upgrade/prepare.py +++ b/tests/robot-cases/Group3-Upgrade/prepare.py @@ -385,7 +385,6 @@ class HarborAPI: raise Exception(r"Error: Robot account count {} is not legal!".format(len(robot_account["access"]))) else: raise Exception(r"Error: Feature {} has no branch {}.".format(sys._getframe().f_code.co_name, branch)) - print(payload) body=dict(body=payload) request(url+"projects/"+projectid+"/robots", 'post', **body) @@ -507,7 +506,6 @@ class HarborAPI: ], "enabled":webhook["enabled"] } - print(payload) body=dict(body=payload) request(url+"projects/"+projectid+"/webhook/policies", 'post', **body) elif kwargs["branch"] == 2: @@ -536,7 +534,6 @@ class HarborAPI: "enabled":webhook["enabled"], "name":webhook["name"] } - print(payload) body=dict(body=payload) request(url+"projects/"+projectid+"/webhook/policies", 'post', **body) else: @@ -606,7 +603,6 @@ def request(url, method, user = None, userp = None, **kwargs): kwargs['headers']['Content-Type'] = 'application/json' kwargs['data'] = json.dumps(kwargs['body']) del kwargs['body'] - print("url: ", url) resp = requests.request(method, url, verify=False, auth=(user, userp), **kwargs) if resp.status_code >= 400: raise Exception("[Exception Message] - {}".format(resp.text))