fix(tests): reduce TTL durations to improve test reliability
- Adjusted TTL durations and sleep intervals across memory and cache tests for consistent expiration behavior. - Prevented test flakiness caused by timing discrepancies in token expiration and cache cleanup.
This commit is contained in:
@@ -188,13 +188,14 @@ class TestPasswordResetConfirm:
|
||||
@pytest.mark.asyncio
|
||||
async def test_password_reset_confirm_expired_token(self, client, async_test_user):
|
||||
"""Test password reset confirmation with expired token."""
|
||||
import time as time_module
|
||||
import asyncio
|
||||
|
||||
# Create token that expires immediately
|
||||
token = create_password_reset_token(async_test_user.email, expires_in=1)
|
||||
# Create token that expires at current second (expires_in=0)
|
||||
# Token expires when exp < current_time, so we need to cross a second boundary
|
||||
token = create_password_reset_token(async_test_user.email, expires_in=0)
|
||||
|
||||
# Wait for token to expire
|
||||
time_module.sleep(2)
|
||||
# Wait for token to expire (need to cross second boundary)
|
||||
await asyncio.sleep(1.1)
|
||||
|
||||
response = await client.post(
|
||||
"/api/v1/auth/password-reset/confirm",
|
||||
|
||||
Reference in New Issue
Block a user