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

@@ -764,7 +764,11 @@ def test_should_send_email_if_team_api_key_and_a_service_user(notify_api, sample
assert response.status_code == 201
def test_should_send_email_to_anyone_with_test_key(notify_api, sample_email_template, mocker):
@pytest.mark.parametrize('restricted', [True, False])
@pytest.mark.parametrize('limit', [0, 1])
def test_should_send_email_to_anyone_with_test_key(
notify_api, sample_email_template, mocker, restricted, limit
):
with notify_api.test_request_context(), notify_api.test_client() as client:
mocker.patch('app.celery.tasks.send_email.apply_async')
@@ -772,7 +776,8 @@ def test_should_send_email_to_anyone_with_test_key(notify_api, sample_email_temp
'to': 'anyone123@example.com',
'template': sample_email_template.id
}
sample_email_template.service.restricted = True
sample_email_template.service.restricted = restricted
sample_email_template.service.message_limit = limit
api_key = ApiKey(
service=sample_email_template.service,
name='test_key',