mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 23:55:58 -05:00
ensure no tests share the same name (using flake8's checker)
This commit is contained in:
@@ -626,6 +626,12 @@ def test_post_email_notification_with_valid_reply_to_id_returns_201(client, samp
|
||||
assert resp_json['id'] == str(notification.id)
|
||||
assert mocked.called
|
||||
|
||||
email_reply_to = NotificationEmailReplyTo.query.one()
|
||||
|
||||
assert email_reply_to.notification_id == notification.id
|
||||
assert email_reply_to.service_email_reply_to_id == reply_to_email.id
|
||||
assert notification.reply_to_text == reply_to_email.email_address
|
||||
|
||||
|
||||
def test_post_email_notification_with_invalid_reply_to_id_returns_400(client, sample_email_template, mocker, fake_uuid):
|
||||
mocked = mocker.patch('app.celery.provider_tasks.deliver_email.apply_async')
|
||||
@@ -646,33 +652,6 @@ def test_post_email_notification_with_invalid_reply_to_id_returns_400(client, sa
|
||||
assert 'BadRequestError' in resp_json['errors'][0]['error']
|
||||
|
||||
|
||||
def test_post_email_notification_with_valid_reply_to_id_returns_201(client, sample_email_template, mocker):
|
||||
reply_to_email = create_reply_to_email(sample_email_template.service, 'test@test.com')
|
||||
mocked = mocker.patch('app.celery.provider_tasks.deliver_email.apply_async')
|
||||
data = {
|
||||
"email_address": sample_email_template.service.users[0].email_address,
|
||||
"template_id": sample_email_template.id,
|
||||
'email_reply_to_id': reply_to_email.id
|
||||
}
|
||||
auth_header = create_authorization_header(service_id=sample_email_template.service_id)
|
||||
response = client.post(
|
||||
path="v2/notifications/email",
|
||||
data=json.dumps(data),
|
||||
headers=[('Content-Type', 'application/json'), auth_header])
|
||||
assert response.status_code == 201
|
||||
resp_json = json.loads(response.get_data(as_text=True))
|
||||
assert validate(resp_json, post_email_response) == resp_json
|
||||
notification = Notification.query.first()
|
||||
assert resp_json['id'] == str(notification.id)
|
||||
assert mocked.called
|
||||
|
||||
email_reply_to = NotificationEmailReplyTo.query.one()
|
||||
|
||||
assert email_reply_to.notification_id == notification.id
|
||||
assert email_reply_to.service_email_reply_to_id == reply_to_email.id
|
||||
assert notification.reply_to_text == reply_to_email.email_address
|
||||
|
||||
|
||||
def test_persist_sender_to_notification_mapping_for_email(notify_db_session):
|
||||
service = create_service()
|
||||
template = create_template(service=service, template_type=EMAIL_TYPE)
|
||||
|
||||
Reference in New Issue
Block a user