mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-07 10:28:24 -04:00
Return template name in public API
The use for the public template API is for building caseworking systems or similar, where you might need a list of templates to pick from (ie instead of using the Notify web interface to pick from and send a message). Right now our API isn’t returning the template name as part of the response. The name is a useful, human-friendly way of identifying a template. This commit changes the response to include the name. Some clients will need updating before this can be useful.
This commit is contained in:
@@ -10,13 +10,13 @@ from tests.app.db import create_template
|
||||
valid_version_params = [None, 1]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("tmp_type, expected_subject", [
|
||||
(SMS_TYPE, None),
|
||||
(EMAIL_TYPE, 'Template subject'),
|
||||
(LETTER_TYPE, 'Template subject')
|
||||
@pytest.mark.parametrize("tmp_type, expected_name, expected_subject", [
|
||||
(SMS_TYPE, 'sms Template Name', None),
|
||||
(EMAIL_TYPE, 'email Template Name', 'Template subject'),
|
||||
(LETTER_TYPE, 'letter Template Name', 'Template subject')
|
||||
])
|
||||
@pytest.mark.parametrize("version", valid_version_params)
|
||||
def test_get_template_by_id_returns_200(client, sample_service, tmp_type, expected_subject, version):
|
||||
def test_get_template_by_id_returns_200(client, sample_service, tmp_type, expected_name, expected_subject, version):
|
||||
template = create_template(sample_service, template_type=tmp_type)
|
||||
auth_header = create_authorization_header(service_id=sample_service.id)
|
||||
|
||||
@@ -38,7 +38,8 @@ def test_get_template_by_id_returns_200(client, sample_service, tmp_type, expect
|
||||
'version': template.version,
|
||||
'created_by': template.created_by.email_address,
|
||||
'body': template.content,
|
||||
"subject": expected_subject
|
||||
"subject": expected_subject,
|
||||
'name': expected_name,
|
||||
}
|
||||
|
||||
assert json_response == expected_response
|
||||
|
||||
Reference in New Issue
Block a user