Example #1
0
 def get_client(self):
     if self.active:
         client = Client(self.host)
         client.set_auth(self.login, self.pwd)
     else:
         client = None
     return client
Example #2
0
class CommandHandler(object):
    def __init__(self):
        self.client = None

    def date2str(self, dt):
        return dt.strftime(DATE_FORMAT)

    def run(self, url, json_output, user=False, debug=False):
        if not json_output:
            print(self.Meta.command)
        self.client = Client(url, verbose=not json_output)
        if debug:
            self.client.set_debug(True)
        if user:
            login, password = user.split(':')
            self.client.set_auth(login, password)
Example #3
0
 def test_set_auth(self, fixture_registry_url, fixture_auth):
     client = Client(fixture_registry_url)
     client.set_auth(fixture_auth.get('login'),
                     fixture_auth.get('password'))
     assert client.auth == fixture_auth