Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions services/web/server/tests/unit/with_dbs/01/test_api_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# pylint: disable=unused-variable
# pylint: disable=too-many-arguments

import asyncio
from collections.abc import AsyncIterable
from datetime import timedelta
from http import HTTPStatus
Expand Down Expand Up @@ -172,9 +171,15 @@ async def test_create_api_key_with_expiration(
assert [d["displayName"] for d in data] == ["foo"]

# wait for api-key for it to expire and force-run scheduled task
await asyncio.sleep(expiration_interval.seconds)
deleted = await prune_expired_api_keys(client.app)
assert deleted == ["foo"]
async for attempt in tenacity.AsyncRetrying(
wait=wait_fixed(1),
retry=retry_if_exception_type(AssertionError),
stop=stop_after_attempt(5),
reraise=True,
):
with attempt:
deleted = await prune_expired_api_keys(client.app)
assert deleted == ["foo"]

resp = await client.get("/v0/auth/api-keys")
data, _ = await assert_status(resp, expected)
Expand Down
Loading