From aab36157a5c071d37e0eefcabd63e50f233879e6 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 8 Feb 2019 11:33:36 +0000 Subject: [PATCH] Test for HTML response in the schema MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because we test for the other properties in the schema. Also sets `additionalProperties` to `False` so we’re forced to update the schemas if we make similar changes in the future. This means removing `created_by` from the test data because it’s not returned by the real response. --- app/v2/template/template_schemas.py | 6 ++++-- tests/app/v2/template/test_template_schemas.py | 7 +++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/v2/template/template_schemas.py b/app/v2/template/template_schemas.py index 38892fb99..a9c9afece 100644 --- a/app/v2/template/template_schemas.py +++ b/app/v2/template/template_schemas.py @@ -66,9 +66,11 @@ post_template_preview_response = { "version": {"type": "integer"}, "body": {"type": "string"}, "subject": {"type": ["string", "null"]}, - "postage": {"type": "string"} + "postage": {"type": "string"}, + "html": {"type": ["string", "null"]}, }, - "required": ["id", "type", "version", "body"] + "required": ["id", "type", "version", "body"], + "additionalProperties": False, } diff --git a/tests/app/v2/template/test_template_schemas.py b/tests/app/v2/template/test_template_schemas.py index f5a89b922..de84ad661 100644 --- a/tests/app/v2/template/test_template_schemas.py +++ b/tests/app/v2/template/test_template_schemas.py @@ -71,17 +71,16 @@ valid_json_post_response = { 'id': str(uuid.uuid4()), 'type': 'email', 'version': 1, - 'created_by': 'someone@test.com', - 'body': 'some body' + 'body': 'some body', } valid_json_post_response_with_optionals = { 'id': str(uuid.uuid4()), 'type': 'email', 'version': 1, - 'created_by': 'someone@test.com', 'body': "some body", - 'subject': 'some subject' + 'subject': 'some subject', + 'html': '

some body

', }