(self, secret, token, now, ttl_sec, backend, monkeypatch)
| 84 | |
| 85 | @json_parametrize(("secret", "token", "now", "ttl_sec"), "invalid.json") |
| 86 | def test_invalid(self, secret, token, now, ttl_sec, backend, monkeypatch): |
| 87 | f = Fernet(secret.encode("ascii"), backend=backend) |
| 88 | current_time = int(datetime.datetime.fromisoformat(now).timestamp()) |
| 89 | with pytest.raises(InvalidToken): |
| 90 | f.decrypt_at_time( |
| 91 | token.encode("ascii"), |
| 92 | ttl=ttl_sec, |
| 93 | current_time=current_time, |
| 94 | ) |
| 95 | monkeypatch.setattr(time, "time", lambda: current_time) |
| 96 | with pytest.raises(InvalidToken): |
| 97 | f.decrypt(token.encode("ascii"), ttl=ttl_sec) |
| 98 | |
| 99 | def test_invalid_start_byte(self, backend): |
| 100 | f = Fernet(base64.urlsafe_b64encode(b"\x00" * 32), backend=backend) |
nothing calls this directly
no test coverage detected