MCPcopy Create free account
hub / github.com/authlib/authlib / test_refresh_token

Function test_refresh_token

tests/clients/test_requests/test_assertion_session.py:24–61  ·  view source on GitHub ↗
(token)

Source from the content-addressed store, hash-verified

22
23
24def test_refresh_token(token):
25 def verifier(r, **kwargs):
26 resp = mock.MagicMock()
27 resp.status_code = 200
28 if r.url == "https://provider.test/token":
29 assert "assertion=" in r.body
30 resp.json = lambda: token
31 return resp
32
33 sess = AssertionSession(
34 "https://provider.test/token",
35 issuer="foo",
36 subject="foo",
37 audience="foo",
38 alg="HS256",
39 key="secret",
40 )
41 sess.send = verifier
42 sess.get("https://provider.test")
43
44 # trigger more case
45 now = int(time.time())
46 sess = AssertionSession(
47 "https://provider.test/token",
48 issuer="foo",
49 subject=None,
50 audience="foo",
51 issued_at=now,
52 expires_at=now + 3600,
53 header={"alg": "HS256"},
54 key="secret",
55 scope="email",
56 claims={"test_mode": "true"},
57 )
58 sess.send = verifier
59 sess.get("https://provider.test")
60 # trigger for branch test case
61 sess.get("https://provider.test")
62
63
64def test_without_alg():

Callers

nothing calls this directly

Calls 2

AssertionSessionClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected