Commit e0b74db
committed
Add MockRateLimiter test utility
Introduce tests/mock_limiter.py providing a MockRateLimiter class for tests. The mock is configurable via should_allow and an optional state, returns (allowed, state) from check(key, weight), records check calls, and supports reset() to clear recorded calls. Default state values mirror common rate-limit fields (allowed, remaining, limit, retry_after, reset_after).1 parent 134804c commit e0b74db
1 file changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
0 commit comments