canaille-globuzma/tests/oidc/test_token_revocation.py
2022-05-19 12:36:39 +02:00

28 lines
696 B
Python

from . import client_credentials
def test_token_revocation(testclient, user, client, token):
assert not token.revokation_date
res = testclient.post(
"/oauth/revoke",
params=dict(
token=token.access_token,
),
headers={"Authorization": f"Basic {client_credentials(client)}"},
status=200,
)
assert {} == res.json
token.reload()
assert token.revokation_date
def test_token_invalid(testclient, client):
res = testclient.post(
"/oauth/revoke",
params=dict(token="invalid"),
headers={"Authorization": f"Basic {client_credentials(client)}"},
status=200,
)
assert {} == res.json