mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-28 11:37:42 +01:00
3f75f0db32
Signed-off-by: Shengwen Yu <yshengwen@vmware.com> Co-authored-by: Shengwen Yu <yshengwen@vmware.com>
24 lines
1.0 KiB
Python
24 lines
1.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
import time
|
|
import base
|
|
import v2_swagger_client
|
|
from v2_swagger_client.rest import ApiException
|
|
|
|
class StopScanAll(base.Base):
|
|
def __init__(self):
|
|
super(StopScanAll,self).__init__(api_type="scanall")
|
|
|
|
def stop_scan_all(self, expect_status_code=202, expect_response_body=None, **kwargs):
|
|
try:
|
|
_, status_code, _ = self._get_client(**kwargs).stop_scan_all_with_http_info()
|
|
except ApiException as e:
|
|
if e.status == expect_status_code:
|
|
if expect_response_body is not None and e.body.strip() != expect_response_body.strip():
|
|
raise Exception(r"Stop scan all response body is not as expected {} actual status is {}.".format(expect_response_body.strip(), e.body.strip()))
|
|
else:
|
|
return e.reason, e.body
|
|
else:
|
|
raise Exception(r"Stop scan all result is not as expected {} actual status is {}.".format(expect_status_code, e.status))
|
|
base._assert_status_code(expect_status_code, status_code)
|