def test_get_access_cookie(): """Get response for a valid cookie.""" cookies = get_auth_cookies(HERE_USER, HERE_PASSWORD) exp = [ "here_access_oidc", "here_auth_oidc", "here_access", "here_auth", "here_ca_access", ] assert set(cookies.keys()) == set(exp)
def test_get_tokens_cookies(api): """Get the tokens.""" # url = "http://xyz.api.here.com/token-api/tokens" cookies = get_auth_cookies(HERE_USER, HERE_PASSWORD) # tokens = requests.get(url, cookies=cookies).json() tokens = api.get(path="/token-api/tokens", cookies=cookies).json() assert type(tokens) == list api.headers = {} tokens = api.get(path="/token-api/tokens").json() assert type(tokens) == list api.headers = {} tokens = api.get_tokens() assert type(tokens) == list
def test_bad_credentials(): """Raise error for invalid account credentials.""" with pytest.raises(AuthenticationError): get_auth_cookies(username="******", password="******")