To make the deployment and testing a little easier move the high volume service ids to the credential repo.

This way we can only add the ids when we are ready and all the infrastrure for the new service has been applied.
This commit is contained in:
Rebecca Law
2020-03-27 08:02:51 +00:00
parent e4df43e412
commit dc44cb29d1
3 changed files with 14 additions and 11 deletions

View File

@@ -955,8 +955,9 @@ def test_post_email_notification_when_data_is_empty_returns_400(client, sample_s
def test_post_notifications_saves_email_to_queue(client, notify_db_session, mocker):
save_email_task = mocker.patch("app.celery.tasks.save_api_email.apply_async")
mock_send_task = mocker.patch('app.celery.provider_tasks.deliver_email.apply_async')
service = create_service(service_id='539d63a1-701d-400d-ab11-f3ee2319d4d4', service_name='high volume service')
service = create_service(service_id='941b6f9a-50d7-4742-8d50-f365ca74bf27', service_name='high volume service')
template = create_template(service=service, content='((message))', template_type=EMAIL_TYPE)
data = {
"email_address": "joe.citizen@example.com",
@@ -976,14 +977,15 @@ def test_post_notifications_saves_email_to_queue(client, notify_db_session, mock
assert json_resp['content']['body'] == "Dear citizen, have a nice day"
assert json_resp['template']['id'] == str(template.id)
save_email_task.assert_called_once_with([mock.ANY], queue='save-api-email-tasks')
assert not mock_send_task.called
assert len(Notification.query.all()) == 0
def test_post_notifications_doesnt_save_email_to_queue_for_test_emails(client, notify_db_session, mocker):
save_email_task = mocker.patch("app.celery.tasks.save_api_email.apply_async")
mocked_send_task = mocker.patch('app.celery.provider_tasks.deliver_email.apply_async')
mock_send_task = mocker.patch('app.celery.provider_tasks.deliver_email.apply_async')
service = create_service(service_id='539d63a1-701d-400d-ab11-f3ee2319d4d4', service_name='high volume service')
service = create_service(service_id='941b6f9a-50d7-4742-8d50-f365ca74bf27', service_name='high volume service')
# create_api_key(service=service, key_type='test')
template = create_template(service=service, content='((message))', template_type=EMAIL_TYPE)
data = {
@@ -1004,16 +1006,16 @@ def test_post_notifications_doesnt_save_email_to_queue_for_test_emails(client, n
assert json_resp['id']
assert json_resp['content']['body'] == "Dear citizen, have a nice day"
assert json_resp['template']['id'] == str(template.id)
assert mocked_send_task.called
assert mock_send_task.called
assert not save_email_task.called
assert len(Notification.query.all()) == 1
def test_post_notifications_doesnt_save_email_to_queue_for_sms(client, notify_db_session, mocker):
save_email_task = mocker.patch("app.celery.tasks.save_api_email.apply_async")
mocked_send_task = mocker.patch('app.celery.provider_tasks.deliver_sms.apply_async')
mock_send_task = mocker.patch('app.celery.provider_tasks.deliver_sms.apply_async')
service = create_service(service_id='539d63a1-701d-400d-ab11-f3ee2319d4d4', service_name='high volume service')
service = create_service(service_id='941b6f9a-50d7-4742-8d50-f365ca74bf27', service_name='high volume service')
template = create_template(service=service, content='((message))', template_type=SMS_TYPE)
data = {
"phone_number": '+447700900855',
@@ -1030,7 +1032,7 @@ def test_post_notifications_doesnt_save_email_to_queue_for_sms(client, notify_db
assert response.status_code == 201
assert json_resp['id']
assert mocked_send_task.called
assert mock_send_task.called
assert not save_email_task.called
assert len(Notification.query.all()) == 1