mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Quietly ignore extra personalisation
> If a user makes an API request with additional personalisation fields, > we should simply discard any fields that the template doesn't have. > > This gives a couple of related advantages: > > - modifying template parameters no longer requires downtime for > clients - as they can pass in extra new parameters before a template > change, or continue passing in old unused parameters after removing > them from a template > > - services can pass in large user objects, for example, and then play > around with templates adding and removing fields at will > > we should make sure we still return an error if a user doesn't pass in > a required parameter. – https://www.pivotaltracker.com/story/show/140774195
This commit is contained in:
@@ -36,11 +36,9 @@ def test_create_content_for_notification_fails_with_missing_personalisation(samp
|
||||
create_content_for_notification(template, None)
|
||||
|
||||
|
||||
def test_create_content_for_notification_fails_with_additional_personalisation(sample_template_with_placeholders):
|
||||
def test_create_content_for_notification_allows_additional_personalisation(sample_template_with_placeholders):
|
||||
template = Template.query.get(sample_template_with_placeholders.id)
|
||||
with pytest.raises(BadRequestError) as e:
|
||||
create_content_for_notification(template, {'name': 'Bobby', 'Additional placeholder': 'Data'})
|
||||
assert e.value.message == 'Template personalisation not needed for template: Additional placeholder'
|
||||
create_content_for_notification(template, {'name': 'Bobby', 'Additional placeholder': 'Data'})
|
||||
|
||||
|
||||
@freeze_time("2016-01-01 11:09:00.061258")
|
||||
|
||||
Reference in New Issue
Block a user