unit test bug fixes
This commit is contained in:
@@ -474,10 +474,13 @@ class TestRateLimiterEdgeCases:
|
||||
def test_cleanup_updates_last_cleanup_time(self):
|
||||
"""Test that cleanup updates last_cleanup timestamp."""
|
||||
limiter = RateLimiter()
|
||||
old_cleanup_time = limiter.last_cleanup
|
||||
|
||||
# Force cleanup
|
||||
limiter.cleanup_interval = 0
|
||||
# Set last_cleanup to past to ensure cleanup triggers
|
||||
old_cleanup_time = datetime.now(timezone.utc) - timedelta(hours=2)
|
||||
limiter.last_cleanup = old_cleanup_time
|
||||
limiter.cleanup_interval = 0 # Force cleanup on next request
|
||||
|
||||
# Make request (should trigger cleanup)
|
||||
limiter.allow_request("test", 10, 3600)
|
||||
|
||||
# last_cleanup should be updated
|
||||
|
||||
Reference in New Issue
Block a user