Example #1
0
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)
Example #2
0
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
Example #3
0
def test_bad_credentials():
    """Raise error for invalid account credentials."""
    with pytest.raises(AuthenticationError):
        get_auth_cookies(username="******", password="******")