mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 00:41:35 -05:00
Fixed pep8 issues and hostname in the test environment.
This commit is contained in:
@@ -286,7 +286,6 @@ def test_get_all_notifications_returns_empty_list(notify_api, sample_api_key):
|
||||
def test_filter_by_template_type(notify_api, notify_db, notify_db_session, sample_template, sample_email_template):
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
|
||||
notification_1 = create_sample_notification(
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
@@ -317,7 +316,6 @@ def test_filter_by_multiple_template_types(notify_api,
|
||||
sample_email_template):
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
|
||||
notification_1 = create_sample_notification(
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
@@ -345,7 +343,6 @@ def test_filter_by_multiple_template_types(notify_api,
|
||||
def test_filter_by_status(notify_api, notify_db, notify_db_session, sample_email_template):
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
|
||||
notification_1 = create_sample_notification(
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
@@ -377,7 +374,6 @@ def test_filter_by_multiple_statuss(notify_api,
|
||||
sample_email_template):
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
|
||||
notification_1 = create_sample_notification(
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
@@ -411,7 +407,6 @@ def test_filter_by_status_and_template_type(notify_api,
|
||||
sample_email_template):
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
|
||||
notification_1 = create_sample_notification(
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
@@ -946,7 +941,6 @@ def test_no_limit_for_live_service(notify_api,
|
||||
sample_notification):
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
|
||||
sample_service.message_limit = 1
|
||||
notify_db.session.add(sample_service)
|
||||
notify_db.session.commit()
|
||||
@@ -1347,7 +1341,6 @@ def test_ses_callback_should_fail_if_invalid_json(notify_api):
|
||||
def test_ses_callback_should_fail_if_invalid_notification_type(notify_api):
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
|
||||
response = client.post(
|
||||
path='/notifications/email/ses',
|
||||
data=ses_invalid_notification_type_callback(),
|
||||
@@ -1362,7 +1355,6 @@ def test_ses_callback_should_fail_if_invalid_notification_type(notify_api):
|
||||
def test_ses_callback_should_fail_if_missing_message_id(notify_api):
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
|
||||
response = client.post(
|
||||
path='/notifications/email/ses',
|
||||
data=ses_missing_notification_id_callback(),
|
||||
@@ -1377,7 +1369,6 @@ def test_ses_callback_should_fail_if_missing_message_id(notify_api):
|
||||
def test_ses_callback_should_fail_if_notification_cannot_be_found(notify_db, notify_db_session, notify_api):
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
|
||||
response = client.post(
|
||||
path='/notifications/email/ses',
|
||||
data=ses_invalid_notification_id_callback(),
|
||||
@@ -1427,7 +1418,6 @@ def test_ses_callback_should_update_multiple_notification_status_sent(
|
||||
sample_email_template):
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
|
||||
notification1 = create_sample_notification(
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
@@ -1478,7 +1468,6 @@ def test_ses_callback_should_update_multiple_notification_status_sent(
|
||||
def test_should_handle_invite_email_callbacks(notify_api, notify_db, notify_db_session):
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
|
||||
notify_api.config['INVITATION_EMAIL_FROM'] = 'test-invite'
|
||||
notify_api.config['NOTIFY_EMAIL_DOMAIN'] = 'test-domain.com'
|
||||
|
||||
@@ -1496,7 +1485,6 @@ def test_should_handle_invite_email_callbacks(notify_api, notify_db, notify_db_s
|
||||
def test_should_handle_validation_code_callbacks(notify_api, notify_db, notify_db_session):
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
|
||||
notify_api.config['VERIFY_CODE_FROM_EMAIL_ADDRESS'] = 'valid-code@test.com'
|
||||
|
||||
response = client.post(
|
||||
@@ -1591,12 +1579,11 @@ def test_process_mmg_response_records_statsd(notify_api, sample_notification, mo
|
||||
"deliverytime": "2016-04-05 16:01:07"})
|
||||
|
||||
client.post(path='notifications/sms/mmg',
|
||||
data=data,
|
||||
headers=[('Content-Type', 'application/json')])
|
||||
data=data,
|
||||
headers=[('Content-Type', 'application/json')])
|
||||
app.statsd_client.incr.assert_called_once_with("notifications.callback.mmg.delivered")
|
||||
|
||||
|
||||
|
||||
def test_firetext_callback_should_record_statsd(notify_api, notify_db, notify_db_session, mocker):
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
@@ -1613,7 +1600,6 @@ def test_firetext_callback_should_record_statsd(notify_api, notify_db, notify_db
|
||||
app.statsd_client.incr.assert_called_once_with("notifications.callback.firetext.delivered")
|
||||
|
||||
|
||||
|
||||
def ses_validation_code_callback():
|
||||
return b'{\n "Type" : "Notification",\n "MessageId" : "ref",\n "TopicArn" : "arn:aws:sns:eu-west-1:123456789012:testing",\n "Message" : "{\\"notificationType\\":\\"Delivery\\",\\"mail\\":{\\"timestamp\\":\\"2016-03-14T12:35:25.909Z\\",\\"source\\":\\"valid-code@test.com\\",\\"sourceArn\\":\\"arn:aws:ses:eu-west-1:123456789012:identity/testing-notify\\",\\"sendingAccountId\\":\\"123456789012\\",\\"messageId\\":\\"ref\\",\\"destination\\":[\\"testing@digital.cabinet-office.gov.uk\\"]},\\"delivery\\":{\\"timestamp\\":\\"2016-03-14T12:35:26.567Z\\",\\"processingTimeMillis\\":658,\\"recipients\\":[\\"testing@digital.cabinet-office.gov.u\\"],\\"smtpResponse\\":\\"250 2.0.0 OK 1457958926 uo5si26480932wjc.221 - gsmtp\\",\\"reportingMTA\\":\\"a6-238.smtp-out.eu-west-1.amazonses.com\\"}}",\n "Timestamp" : "2016-03-14T12:35:26.665Z",\n "SignatureVersion" : "1",\n "Signature" : "X8d7eTAOZ6wlnrdVVPYanrAlsX0SMPfOzhoTEBnQqYkrNWTqQY91C0f3bxtPdUhUtOowyPAOkTQ4KnZuzphfhVb2p1MyVYMxNKcBFB05/qaCX99+92fjw4x9LeUOwyGwMv5F0Vkfi5qZCcEw69uVrhYLVSTFTrzi/yCtru+yFULMQ6UhbY09GwiP6hjxZMVr8aROQy5lLHglqQzOuSZ4KeD85JjifHdKzlx8jjQ+uj+FLzHXPMAPmPU1JK9kpoHZ1oPshAFgPDpphJe+HwcJ8ezmk+3AEUr3wWli3xF+49y8Z2anASSVp6YI2YP95UT8Rlh3qT3T+V9V8rbSVislxA==",\n "SigningCertURL" : "https://sns.eu-west-1.amazonaws.com/SimpleNotificationService-bb750dd426d95ee9390147a5624348ee.pem",\n "UnsubscribeURL" : "https://sns.eu-west-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:eu-west-1:302763885840:preview-emails:d6aad3ef-83d6-4cf3-a470-54e2e75916da"\n}' # noqa
|
||||
|
||||
|
||||
Reference in New Issue
Block a user