Enable back door for clearing user's rate-limit history.

(This is helpful to make the tests run faster.)

(imported from commit 48c1beaed8cca76976bd6f54224c33460b55ceac)
This commit is contained in:
Steve Howell
2013-06-20 17:18:39 -04:00
parent 9ca7d58cac
commit 67058cc26f
2 changed files with 21 additions and 6 deletions

View File

@@ -54,6 +54,14 @@ def unblock_user(user, domain='all'):
_, _, blocking_key = redis_key(user, domain)
client.delete(blocking_key)
def clear_user_history(user, domain='all'):
'''
This is only used by test code now, where it's very helpful in
allowing us to run tests quickly, by giving a user a clean slate.
'''
for key in redis_key(user, domain):
client.delete(key)
def _get_api_calls_left(user, domain, range_seconds, max_calls):
list_key, set_key, _ = redis_key(user, domain)
# Count the number of values in our sorted set