harbor/tests/apitests/python/library/scanner.py
danfengliu 77e9fc38c7 Modify api test for test step of add addition
Signed-off-by: danfengliu <danfengl@vmware.com>
2020-03-18 17:32:10 +08:00

27 lines
852 B
Python

# -*- coding: utf-8 -*-
import time
import base
import swagger_client
from swagger_client.rest import ApiException
class Scanner(base.Base, object):
def __init__(self):
super(Scanner,self).__init__(api_type = "scanner")
def scanners_get(self, **kwargs):
client = self._get_client(**kwargs)
return client.scanners_get()
def scanners_get_uuid(self, is_default = False, **kwargs):
scanners = self.scanners_get(**kwargs)
for scanner in scanners:
if scanner.is_default == is_default:
return scanner.uuid
def scanners_registration_id_patch(self, registration_id, is_default = True, **kwargs):
client = self._get_client(**kwargs)
isdefault = swagger_client.IsDefault(is_default)
client.scanners_registration_id_patch(registration_id, isdefault)