Allow test key to send irrespective of daily limit

When you use a simulate API key it should behave like a live service,
except for actually sending the messages. There should be no limits even
if the service is in trial mode.

This commit removes the restriction on sending messages when you’ve sent
up to your daily limit.
This commit is contained in:
Chris Hill-Scott
2016-08-30 11:00:22 +01:00
parent 5eaec8c235
commit 7769923dda
2 changed files with 11 additions and 3 deletions

View File

@@ -215,7 +215,10 @@ def send_notification(notification_type):
service_stats = sum(row.count for row in dao_fetch_todays_stats_for_service(service.id))
if service_stats >= service.message_limit:
if all((
api_user.key_type != KEY_TYPE_TEST,
service_stats >= service.message_limit
)):
error = 'Exceeded send limits ({}) for today'.format(service.message_limit)
raise InvalidRequest(error, status_code=429)