mirror of
https://github.com/GSA/notifications-api.git
synced 2026-05-30 02:49:41 -04:00
Create template to verify service email reply-to addresses
So that template with the same ID is present on all environments
This commit is contained in:
@@ -150,7 +150,7 @@ class Config(object):
|
||||
ORGANISATION_INVITATION_EMAIL_TEMPLATE_ID = '203566f0-d835-47c5-aa06-932439c86573'
|
||||
TEAM_MEMBER_EDIT_EMAIL_TEMPLATE_ID = 'c73f1d71-4049-46d5-a647-d013bdeca3f0'
|
||||
TEAM_MEMBER_EDIT_MOBILE_TEMPLATE_ID = '8a31520f-4751-4789-8ea1-fe54496725eb'
|
||||
REPLY_TO_EMAIL_ADDRESS_VERIFICATION_TEMPLATE_ID = '2d1ff26c-4d20-4cb2-8918-a0bec4002c9e'
|
||||
REPLY_TO_EMAIL_ADDRESS_VERIFICATION_TEMPLATE_ID = 'a42f1d17-9404-46d5-a647-d013bdfca3e1'
|
||||
|
||||
BROKER_URL = 'sqs://'
|
||||
BROKER_TRANSPORT_OPTIONS = {
|
||||
|
||||
82
migrations/versions/0294_add_verify_reply_to_.py
Normal file
82
migrations/versions/0294_add_verify_reply_to_.py
Normal file
@@ -0,0 +1,82 @@
|
||||
"""
|
||||
|
||||
Revision ID: 0294_add_verify_reply_to
|
||||
Revises: 0293_drop_complaint_fk
|
||||
Create Date: 2019-05-22 16:58:52.929661
|
||||
|
||||
"""
|
||||
from datetime import datetime
|
||||
|
||||
from alembic import op
|
||||
from flask import current_app
|
||||
|
||||
|
||||
revision = '0294_add_verify_reply_to'
|
||||
down_revision = '0293_drop_complaint_fk'
|
||||
|
||||
email_template_id = "a42f1d17-9404-46d5-a647-d013bdfca3e1"
|
||||
|
||||
|
||||
def upgrade():
|
||||
template_insert = """
|
||||
INSERT INTO templates (id, name, template_type, created_at, content, archived, service_id, subject,
|
||||
created_by_id, version, process_type, hidden)
|
||||
VALUES ('{}', '{}', '{}', '{}', '{}', False, '{}', '{}', '{}', 1, '{}', false)
|
||||
"""
|
||||
template_history_insert = """
|
||||
INSERT INTO templates_history (id, name, template_type, created_at, content, archived, service_id, subject,
|
||||
created_by_id, version, process_type, hidden)
|
||||
VALUES ('{}', '{}', '{}', '{}', '{}', False, '{}', '{}', '{}', 1, '{}', false)
|
||||
"""
|
||||
|
||||
email_template_content = '\n'.join([
|
||||
"Hi,",
|
||||
"",
|
||||
"This address has been provided as a reply-to email address for a GOV.UK Notify account.",
|
||||
"Any replies from users to emails they receive through GOV.UK Notify will come back to this email address.",
|
||||
"",
|
||||
"This is just a quick check to make sure the address is valid.",
|
||||
"",
|
||||
"No need to reply.",
|
||||
"",
|
||||
"Thanks",
|
||||
"",
|
||||
"GOV.UK Notify team",
|
||||
"https://www.gov.uk/notify"
|
||||
])
|
||||
|
||||
email_template_name = "Verify email reply-to address for a service"
|
||||
email_template_subject = 'Your GOV.UK Notify reply-to email address'
|
||||
|
||||
op.execute(
|
||||
template_history_insert.format(
|
||||
email_template_id,
|
||||
email_template_name,
|
||||
'email',
|
||||
datetime.utcnow(),
|
||||
email_template_content,
|
||||
current_app.config['NOTIFY_SERVICE_ID'],
|
||||
email_template_subject,
|
||||
current_app.config['NOTIFY_USER_ID'],
|
||||
'normal'
|
||||
)
|
||||
)
|
||||
|
||||
op.execute(
|
||||
template_insert.format(
|
||||
email_template_id,
|
||||
email_template_name,
|
||||
'email',
|
||||
datetime.utcnow(),
|
||||
email_template_content,
|
||||
current_app.config['NOTIFY_SERVICE_ID'],
|
||||
email_template_subject,
|
||||
current_app.config['NOTIFY_USER_ID'],
|
||||
'normal'
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.execute("DELETE FROM templates_history WHERE id = '{}'".format(email_template_id))
|
||||
op.execute("DELETE FROM templates WHERE id = '{}'".format(email_template_id))
|
||||
@@ -2491,7 +2491,6 @@ def test_get_email_reply_to_addresses_with_multiple_email_addresses(client, noti
|
||||
assert not json_response[1]['updated_at']
|
||||
|
||||
|
||||
@freeze_time("2016-01-01 11:09:00.061258")
|
||||
def test_verify_reply_to_email_address_should_send_verification_email(
|
||||
admin_request, notify_db, notify_db_session, mocker, verify_reply_to_address_email_template
|
||||
):
|
||||
@@ -2523,7 +2522,7 @@ def test_verify_reply_to_email_address_doesnt_allow_duplicates(admin_request, no
|
||||
_data=data,
|
||||
_expected_status=400
|
||||
)
|
||||
assert response["message"] == "Your service already uses 'reply-here@example.gov.uk' as an email reply-to address."
|
||||
assert response["message"] == "Your service already uses ‘reply-here@example.gov.uk’ as an email reply-to address."
|
||||
|
||||
|
||||
def test_add_service_reply_to_email_address(admin_request, sample_service):
|
||||
@@ -2552,7 +2551,7 @@ def test_add_service_reply_to_email_address_doesnt_allow_duplicates(
|
||||
_data=data,
|
||||
_expected_status=400
|
||||
)
|
||||
assert response["message"] == "Your service already uses 'reply-here@example.gov.uk' as an email reply-to address."
|
||||
assert response["message"] == "Your service already uses ‘reply-here@example.gov.uk’ as an email reply-to address."
|
||||
|
||||
|
||||
def test_add_service_reply_to_email_address_can_add_multiple_addresses(admin_request, sample_service):
|
||||
|
||||
Reference in New Issue
Block a user