mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-20 14:29:25 -04:00
This massive set of changes uses the new queue names object throughout the app and tests.
Lots of changes, all changing the line of code that puts things into queues, and the code that tests that.
This commit is contained in:
@@ -127,7 +127,7 @@ def test_send_notification_with_placeholders_replaced(notify_api, sample_email_t
|
||||
|
||||
mocked.assert_called_once_with(
|
||||
[notification_id],
|
||||
queue="send-email"
|
||||
queue="send-tasks"
|
||||
)
|
||||
assert response.status_code == 201
|
||||
assert response_data['body'] == u'Hello Jo\nThis is an email from GOV.\u200BUK'
|
||||
@@ -338,7 +338,7 @@ def test_should_allow_valid_sms_notification(notify_api, sample_template, mocker
|
||||
response_data = json.loads(response.data)['data']
|
||||
notification_id = response_data['notification']['id']
|
||||
|
||||
mocked.assert_called_once_with([notification_id], queue='send-sms')
|
||||
mocked.assert_called_once_with([notification_id], queue='send-tasks')
|
||||
assert response.status_code == 201
|
||||
assert notification_id
|
||||
assert 'subject' not in response_data
|
||||
@@ -392,7 +392,7 @@ def test_should_allow_valid_email_notification(notify_api, sample_email_template
|
||||
notification_id = response_data['notification']['id']
|
||||
app.celery.provider_tasks.deliver_email.apply_async.assert_called_once_with(
|
||||
[notification_id],
|
||||
queue="send-email"
|
||||
queue="send-tasks"
|
||||
)
|
||||
|
||||
assert response.status_code == 201
|
||||
@@ -593,7 +593,7 @@ def test_should_send_email_if_team_api_key_and_a_service_user(notify_api, sample
|
||||
data=json.dumps(data),
|
||||
headers=[('Content-Type', 'application/json'), ('Authorization', 'Bearer {}'.format(auth_header))])
|
||||
|
||||
app.celery.provider_tasks.deliver_email.apply_async.assert_called_once_with([fake_uuid], queue='send-email')
|
||||
app.celery.provider_tasks.deliver_email.apply_async.assert_called_once_with([fake_uuid], queue='send-tasks')
|
||||
assert response.status_code == 201
|
||||
|
||||
|
||||
@@ -626,7 +626,9 @@ def test_should_send_sms_to_anyone_with_test_key(
|
||||
data=json.dumps(data),
|
||||
headers=[('Content-Type', 'application/json'), ('Authorization', 'Bearer {}'.format(auth_header))]
|
||||
)
|
||||
app.celery.provider_tasks.deliver_sms.apply_async.assert_called_once_with([fake_uuid], queue='research-mode')
|
||||
app.celery.provider_tasks.deliver_sms.apply_async.assert_called_once_with(
|
||||
[fake_uuid], queue='research-mode-tasks'
|
||||
)
|
||||
assert response.status_code == 201
|
||||
|
||||
|
||||
@@ -660,7 +662,9 @@ def test_should_send_email_to_anyone_with_test_key(
|
||||
headers=[('Content-Type', 'application/json'), ('Authorization', 'Bearer {}'.format(auth_header))]
|
||||
)
|
||||
|
||||
app.celery.provider_tasks.deliver_email.apply_async.assert_called_once_with([fake_uuid], queue='research-mode')
|
||||
app.celery.provider_tasks.deliver_email.apply_async.assert_called_once_with(
|
||||
[fake_uuid], queue='research-mode-tasks'
|
||||
)
|
||||
assert response.status_code == 201
|
||||
|
||||
|
||||
@@ -685,7 +689,7 @@ def test_should_send_sms_if_team_api_key_and_a_service_user(notify_api, sample_t
|
||||
data=json.dumps(data),
|
||||
headers=[('Content-Type', 'application/json'), ('Authorization', 'Bearer {}'.format(auth_header))])
|
||||
|
||||
app.celery.provider_tasks.deliver_sms.apply_async.assert_called_once_with([fake_uuid], queue='send-sms')
|
||||
app.celery.provider_tasks.deliver_sms.apply_async.assert_called_once_with([fake_uuid], queue='send-tasks')
|
||||
assert response.status_code == 201
|
||||
|
||||
|
||||
@@ -718,7 +722,7 @@ def test_should_persist_notification(notify_api, sample_template,
|
||||
data=json.dumps(data),
|
||||
headers=[('Content-Type', 'application/json'), ('Authorization', 'Bearer {}'.format(auth_header))])
|
||||
|
||||
mocked.assert_called_once_with([fake_uuid], queue='send-{}'.format(template_type))
|
||||
mocked.assert_called_once_with([fake_uuid], queue='send-tasks')
|
||||
assert response.status_code == 201
|
||||
|
||||
notification = notifications_dao.get_notification_by_id(fake_uuid)
|
||||
@@ -761,7 +765,7 @@ def test_should_delete_notification_and_return_error_if_sqs_fails(
|
||||
data=json.dumps(data),
|
||||
headers=[('Content-Type', 'application/json'), ('Authorization', 'Bearer {}'.format(auth_header))])
|
||||
|
||||
mocked.assert_called_once_with([fake_uuid], queue='send-{}'.format(template_type))
|
||||
mocked.assert_called_once_with([fake_uuid], queue='send-tasks')
|
||||
assert response.status_code == 500
|
||||
assert not notifications_dao.get_notification_by_id(fake_uuid)
|
||||
assert not NotificationHistory.query.get(fake_uuid)
|
||||
@@ -1046,7 +1050,7 @@ def test_send_notification_uses_priority_queue_when_template_is_marked_as_priori
|
||||
notification_id = response_data['notification']['id']
|
||||
|
||||
assert response.status_code == 201
|
||||
mocked.assert_called_once_with([notification_id], queue='priority')
|
||||
mocked.assert_called_once_with([notification_id], queue='priority-tasks')
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@@ -1114,7 +1118,7 @@ def test_should_allow_store_original_number_on_sms_notification(client, sample_t
|
||||
response_data = json.loads(response.data)['data']
|
||||
notification_id = response_data['notification']['id']
|
||||
|
||||
mocked.assert_called_once_with([notification_id], queue='send-sms')
|
||||
mocked.assert_called_once_with([notification_id], queue='send-tasks')
|
||||
assert response.status_code == 201
|
||||
assert notification_id
|
||||
notifications = Notification.query.all()
|
||||
|
||||
Reference in New Issue
Block a user