mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-17 04:58:50 -04:00
Return placeholders when getting a template
> Currently when retrieving a template via one of the clients, we do > not return the personalisation fields that are required for that > template. > > This is useful for services who want to perform template validation on > their own systems. A service user has also requested this. – https://www.pivotaltracker.com/story/show/150674476 This commit adds an extra attribute to the JSON response containing an array of the placeholder names. This key is called "personalisation", to match the argument that developers use to pass in the values of placeholders.
This commit is contained in:
@@ -137,7 +137,8 @@ def sample_service(
|
||||
limit=1000,
|
||||
email_from=None,
|
||||
permissions=[SMS_TYPE, EMAIL_TYPE],
|
||||
research_mode=None
|
||||
research_mode=None,
|
||||
letter_contact_block='London,\nSW1A 1AA',
|
||||
):
|
||||
if user is None:
|
||||
user = create_user()
|
||||
@@ -150,7 +151,7 @@ def sample_service(
|
||||
'restricted': restricted,
|
||||
'email_from': email_from,
|
||||
'created_by': user,
|
||||
'letter_contact_block': 'London,\nSW1A 1AA'
|
||||
'letter_contact_block': letter_contact_block,
|
||||
}
|
||||
service = Service.query.filter_by(name=service_name).first()
|
||||
if not service:
|
||||
@@ -181,6 +182,11 @@ def sample_service_full_permissions(notify_db, notify_db_session):
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def sample_service_custom_letter_contact_block(notify_db, notify_db_session):
|
||||
return sample_service(notify_db, notify_db_session, letter_contact_block='((contact block))')
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def sample_template(
|
||||
notify_db,
|
||||
|
||||
Reference in New Issue
Block a user