Add JSON schema for updating template

We did not have a JSON schema for updating a template. Since we will
remove the postage constraint from the templates table, this adds a JSON
schema for updating a template so that we can use it to check that the
postage is one of the allowed values.
This commit is contained in:
Katie Smith
2020-06-09 17:44:09 +01:00
parent 15112b2148
commit 72be10c681
3 changed files with 38 additions and 3 deletions

View File

@@ -884,6 +884,19 @@ def test_update_template_reply_to_set_to_blank(client, notify_db_session):
assert th.service_letter_contact_id is None
def test_update_template_validates_postage(admin_request, sample_service_full_permissions):
template = create_template(service=sample_service_full_permissions, template_type='letter')
response = admin_request.post(
'template.update_template',
service_id=sample_service_full_permissions.id,
template_id=template.id,
_data={"postage": "third"},
_expected_status=400
)
assert 'postage invalid' in response['errors'][0]['message']
def test_update_template_with_foreign_service_reply_to(client, sample_letter_template):
auth_header = create_authorization_header()