MCPcopy
hub / github.com/authlib/authlib / test_invalid_client

Function test_invalid_client

tests/django/test_oauth2/test_password_grant.py:45–63  ·  view source on GitHub ↗
(factory, server)

Source from the content-addressed store, hash-verified

43
44
45def test_invalid_client(factory, server):
46 request = factory.post(
47 "/oauth/token",
48 data={"grant_type": "password", "username": "foo", "password": "ok"},
49 )
50 resp = server.create_token_response(request)
51 assert resp.status_code == 401
52 data = json.loads(resp.content)
53 assert data["error"] == "invalid_client"
54
55 request = factory.post(
56 "/oauth/token",
57 data={"grant_type": "password", "username": "foo", "password": "ok"},
58 HTTP_AUTHORIZATION=create_basic_auth("invalid", "client-secret"),
59 )
60 resp = server.create_token_response(request)
61 assert resp.status_code == 401
62 data = json.loads(resp.content)
63 assert data["error"] == "invalid_client"
64
65
66def test_invalid_scope(factory, server):

Callers

nothing calls this directly

Calls 3

create_basic_authFunction · 0.85
postMethod · 0.80
create_token_responseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…