diff --git a/tests/testutil.py b/tests/testutil.py index c6cec5c7eb30e2db244c6f15bcf6df6bb4e5c3b4..bb30ffd69af77c206da44de6c718fbb251eb244f 100644 --- a/tests/testutil.py +++ b/tests/testutil.py @@ -112,3 +112,36 @@ class TestConfig: def repository_path(self): return self.repo_path + + +class RTClient: + def __init__(self, + url, + default_login=None, + default_password=None, + proxy=None, + default_queue='General', + skip_login=False, + verify_cert=True, + http_auth=None, + ): + self.url = url + if http_auth is None: + self.user = default_login + self.password = default_password + self.auth_method = 'login' + self.login_result = skip_login or None + else: + self.user = http_auth.username + self.password = http_auth.password + self.auth_method = type(http_auth).__name__ + self.login_result = True + self.last_login = None + + def login(self, login=None, password=None): + if login is None and password is None: + login = self.user + password = self.password + self.login_result = bool(login and password and not password.startswith('bad')) + self.last_login = (login, password, self.login_result) + return self.login_result