def test_basic_auth_with_bad_creds(self): self._do_test_basic_auth( creds=BasicAuthCreds('test_user', 'test_password')) basic_auth = BasicAuth.global_instance() cookies = Cookies.global_instance() bad_creds = BasicAuthCreds('test_user', 'bad_password') self.assertRaises( BasicAuthException, lambda: basic_auth.authenticate( provider='foobar', creds=bad_creds, cookies=cookies))
def _ask_for_creds(provider, url, realm): print(green('\nEnter credentials for:\n')) print('{} {}'.format(green('Provider:'), cyan(provider))) print('{} {}'.format(green('Realm: '), cyan(realm))) print('{} {}'.format(green('URL: '), cyan(url))) print(red('\nONLY ENTER YOUR CREDENTIALS IF YOU TRUST THIS SITE!\n')) username = input(green('Username: '******'Password: ')) return BasicAuthCreds(username, password)
def _ask_for_creds(provider, url, realm): print(green("\nEnter credentials for:\n")) print("{} {}".format(green("Provider:"), cyan(provider))) print("{} {}".format(green("Realm: "), cyan(realm))) print("{} {}".format(green("URL: "), cyan(url))) print(red("\nONLY ENTER YOUR CREDENTIALS IF YOU TRUST THIS SITE!\n")) username = input(green("Username: "******"Password: ")) return BasicAuthCreds(username, password)
def test_basic_auth_with_explicit_creds(self): self._do_test_basic_auth( creds=BasicAuthCreds('test_user', 'test_password'))
def test_basic_auth_with_explicit_creds(self): self._do_test_basic_auth( creds=BasicAuthCreds("test_user", "test_password"))