From 54a1adfe8b7d2389d2a3934c69c78d78fea0f88a Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Thu, 2 Jun 2016 15:58:15 +0100 Subject: [PATCH] fix copypasta error with ses test --- scripts/run_single_test.sh | 2 +- tests/app/notifications/test_rest.py | 53 ++++++++++++++++------------ 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/scripts/run_single_test.sh b/scripts/run_single_test.sh index 663e2e098..57e9428ab 100755 --- a/scripts/run_single_test.sh +++ b/scripts/run_single_test.sh @@ -1,4 +1,4 @@ #!/bin/bash # run a single unit test, pass in the unit test name for example: tests/app/service/test_rest.py::test_get_template_list source environment_test.sh -py.test -s $1 \ No newline at end of file +py.test -s $@ diff --git a/tests/app/notifications/test_rest.py b/tests/app/notifications/test_rest.py index 2155f5ef6..1aad83c2b 100644 --- a/tests/app/notifications/test_rest.py +++ b/tests/app/notifications/test_rest.py @@ -1173,7 +1173,12 @@ def test_firetext_callback_should_return_400_if_invalid_guid_notification_id(not assert json_resp['message'] == 'Firetext callback with invalid reference 1234' -def test_firetext_callback_should_return_404_if_cannot_find_notification_id(notify_db, notify_db_session, notify_api, mocker): +def test_firetext_callback_should_return_404_if_cannot_find_notification_id( + notify_db, + notify_db_session, + notify_api, + mocker +): with notify_api.test_request_context(): with notify_api.test_client() as client: mocker.patch('app.statsd_client.incr') @@ -1279,7 +1284,12 @@ def test_firetext_callback_should_update_notification_status_pending(notify_api, assert stats.sms_failed == 0 -def test_firetext_callback_should_update_multiple_notification_status_sent(notify_api, notify_db, notify_db_session, mocker): +def test_firetext_callback_should_update_multiple_notification_status_sent( + notify_api, + notify_db, + notify_db_session, + mocker +): with notify_api.test_request_context(): with notify_api.test_client() as client: mocker.patch('app.statsd_client.incr') @@ -1563,29 +1573,28 @@ def test_ses_callback_should_update_multiple_notification_status_sent( notify_db, notify_db_session, template=sample_email_template, - reference='ref2', + reference='ref3', status='sending') - client.post( - path='/notifications/sms/firetext', - data='mobile=441234123123&status=0&time=2016-03-10 14:17:00&reference={}'.format( - notification1.id - ), - headers=[('Content-Type', 'application/x-www-form-urlencoded')]) + resp1 = client.post( + path='/notifications/email/ses', + data=ses_notification_callback(ref='ref1'), + headers=[('Content-Type', 'text/plain; charset=UTF-8')] + ) + resp2 = client.post( + path='/notifications/email/ses', + data=ses_notification_callback(ref='ref2'), + headers=[('Content-Type', 'text/plain; charset=UTF-8')] + ) + resp3 = client.post( + path='/notifications/email/ses', + data=ses_notification_callback(ref='ref3'), + headers=[('Content-Type', 'text/plain; charset=UTF-8')] + ) - client.post( - path='/notifications/sms/firetext', - data='mobile=441234123123&status=0&time=2016-03-10 14:17:00&reference={}'.format( - notification2.id - ), - headers=[('Content-Type', 'application/x-www-form-urlencoded')]) - - client.post( - path='/notifications/sms/firetext', - data='mobile=441234123123&status=0&time=2016-03-10 14:17:00&reference={}'.format( - notification3.id - ), - headers=[('Content-Type', 'application/x-www-form-urlencoded')]) + assert resp1.status_code == 200 + assert resp2.status_code == 200 + assert resp3.status_code == 200 stats = dao_get_notification_statistics_for_service(notification1.service_id)[0] assert stats.emails_delivered == 3