test(auth): cover expired-key rejection in APIKeyAuthBackend (Stage 1 PR2)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1445043649
2026-06-28 11:44:41 +08:00
parent d9a86878f4
commit ac8b37bd27
+10
View File
@@ -125,3 +125,13 @@ async def test_authenticate_suspended_workspace_returns_none(tmp_path):
assert await backend.authenticate(gen.plaintext) is None
finally:
await _cleanup()
async def test_authenticate_expired_key_returns_none(tmp_path):
from datetime import UTC, datetime
backend, gen = await _setup_backend(tmp_path, expires_at=datetime(2000, 1, 1, tzinfo=UTC))
try:
assert await backend.authenticate(gen.plaintext) is None
finally:
await _cleanup()