mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 02:11:11 -05:00
update test to pytest.raises instaed of assert response == 500
This commit is contained in:
@@ -698,14 +698,15 @@ def test_should_delete_notification_and_return_error_if_sqs_fails(
|
|||||||
save_model_api_key(api_key)
|
save_model_api_key(api_key)
|
||||||
auth_header = create_jwt_token(secret=api_key.unsigned_secret, client_id=str(api_key.service_id))
|
auth_header = create_jwt_token(secret=api_key.unsigned_secret, client_id=str(api_key.service_id))
|
||||||
|
|
||||||
response = client.post(
|
with pytest.raises(Exception) as exc:
|
||||||
path='/notifications/{}'.format(template_type),
|
response = client.post(
|
||||||
data=json.dumps(data),
|
path='/notifications/{}'.format(template_type),
|
||||||
headers=[('Content-Type', 'application/json'), ('Authorization', 'Bearer {}'.format(auth_header))])
|
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-{}'.format(template_type))
|
||||||
|
assert str(exc.value) == 'failed to talk to SQS'
|
||||||
|
|
||||||
assert response.status_code == 500
|
|
||||||
assert not notifications_dao.get_notification_by_id(fake_uuid)
|
assert not notifications_dao.get_notification_by_id(fake_uuid)
|
||||||
assert not NotificationHistory.query.get(fake_uuid)
|
assert not NotificationHistory.query.get(fake_uuid)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user