test(auth): freeze prefetch cache clock so the org getter cannot miss on a slow runner

Prefetch still writes org entries with the 5s getter TTL. This test only asserts the SQL join, and wall-clock expiry on CI turned that into a MagicMock await TypeError.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Shivi Jain 2026-09-14 22:32:11 +05:30 committed by yassin
parent 75b16df6fa
commit f4e21430c0

View file

@ -66,6 +66,7 @@ async def test_join_binds_the_membership_to_the_requested_team(prisma):
cache = _frozen_cache() cache = _frozen_cache()
refs = AuthObjectRefs(user_id=user_id, team_id=team_a, membership_user_id=user_id, organization_id=org_id) refs = AuthObjectRefs(user_id=user_id, team_id=team_a, membership_user_id=user_id, organization_id=org_id)
await prefetch_auth_objects(refs=refs, user_api_key_cache=cache, prisma_client=prisma) await prefetch_auth_objects(refs=refs, user_api_key_cache=cache, prisma_client=prisma)
assert cache.in_memory_cache.get_cache(f"org_id:{org_id}") is not None
dead_db = _dead_db() dead_db = _dead_db()
membership = await get_team_membership( membership = await get_team_membership(