mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 08:21:13 -05:00
Merge branch 'master' into version-500
This commit is contained in:
@@ -564,6 +564,7 @@ def test_get_notification_by_id_returns_merged_template_content(notify_db,
|
||||
assert response.status_code == 200
|
||||
assert notification['body'] == 'Hello world\nYour thing is due soon'
|
||||
assert 'subject' not in notification
|
||||
assert notification['content_char_count'] == 34
|
||||
|
||||
|
||||
def test_get_notification_by_id_returns_merged_template_content_for_email(
|
||||
@@ -587,6 +588,7 @@ def test_get_notification_by_id_returns_merged_template_content_for_email(
|
||||
assert response.status_code == 200
|
||||
assert notification['body'] == 'Hello world\nThis is an email from GOV.UK'
|
||||
assert notification['subject'] == 'world'
|
||||
assert notification['content_char_count'] is None
|
||||
|
||||
|
||||
def test_get_notifications_for_service_returns_merged_template_content(notify_api,
|
||||
@@ -623,6 +625,44 @@ def test_get_notifications_for_service_returns_merged_template_content(notify_ap
|
||||
}
|
||||
|
||||
|
||||
def test_get_notification_public_api_format_is_not_changed(notify_api, sample_notification):
|
||||
with notify_api.test_request_context(), notify_api.test_client() as client:
|
||||
auth_header = create_authorization_header(service_id=sample_notification.service_id)
|
||||
|
||||
response = client.get(
|
||||
'/notifications/{}'.format(sample_notification.id),
|
||||
headers=[auth_header])
|
||||
|
||||
assert response.status_code == 200
|
||||
notification = json.loads(response.get_data(as_text=True))['data']['notification']
|
||||
# you should never remove things from this list!
|
||||
assert set(notification.keys()) == {
|
||||
# straight from db
|
||||
'id',
|
||||
'to',
|
||||
'job_row_number',
|
||||
'template_version',
|
||||
'billable_units',
|
||||
'notification_type',
|
||||
'created_at',
|
||||
'sent_at',
|
||||
'sent_by',
|
||||
'updated_at',
|
||||
'status',
|
||||
'reference',
|
||||
|
||||
# relationships
|
||||
'template',
|
||||
'service',
|
||||
'job',
|
||||
'api_key',
|
||||
|
||||
# other
|
||||
'body',
|
||||
'content_char_count'
|
||||
}
|
||||
|
||||
|
||||
def test_get_notification_selects_correct_template_for_personalisation(notify_api,
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
|
||||
Reference in New Issue
Block a user