MCPcopy
hub / github.com/authlib/authlib / test_unauthorized_client

Function test_unauthorized_client

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

Source from the content-addressed store, hash-verified

133
134
135def test_unauthorized_client(factory, server, client):
136 client.grant_type = "invalid"
137 client.save()
138 request = factory.post(
139 "/oauth/token",
140 data={
141 "grant_type": "password",
142 "username": "foo",
143 "password": "ok",
144 },
145 HTTP_AUTHORIZATION=create_basic_auth("client-id", "client-secret"),
146 )
147 resp = server.create_token_response(request)
148 assert resp.status_code == 400
149 data = json.loads(resp.content)
150 assert data["error"] == "unauthorized_client"
151
152
153def test_authorize_token(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…