def test_get_auth_url():
    provider = OAuthProvider("google", config)
    auth_url = provider.set_scopes(["email", "openid"]).get_auth_url()
    parts = list(parse.urlparse(auth_url))
    query = dict(parse.parse_qsl(parts[4]))

    if query.get("client_id") != "123":
        raise AssertionError
示例#2
0
def test_get_auth_url():
    provider = OAuthProvider("microsoft", config)
    state = "one"
    auth_url = provider.set_scopes(["email", "openid"]).get_auth_url(state)
    parts = list(parse.urlparse(auth_url))
    query = dict(parse.parse_qsl(parts[4]))

    if query.get("client_id") != "client_id_1":
        raise AssertionError
def test_set_scopes():
    with pytest.raises(ValueError):
        provider = OAuthProvider("invalid", config)
        provider.set_scopes(["error"])