(token)
| 22 | |
| 23 | |
| 24 | def 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 | |
| 64 | def test_without_alg(): |
nothing calls this directly
no test coverage detected