From eba88b08c522b8ef28be1121f58352b63213c495 Mon Sep 17 00:00:00 2001 From: Ken Tsang Date: Tue, 4 Apr 2017 16:14:54 +0100 Subject: [PATCH] Removed URI from preview response --- app/v2/template/post_template.py | 3 +-- app/v2/template/template_schemas.py | 5 ++--- tests/app/v2/template/test_post_template.py | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/v2/template/post_template.py b/app/v2/template/post_template.py index 531a9683c..ca94ee157 100644 --- a/app/v2/template/post_template.py +++ b/app/v2/template/post_template.py @@ -29,8 +29,7 @@ def post_template_preview(template_id): check_placeholders(template_object) resp = create_post_template_preview_response(template=template, - body=str(template_object), - url_root=request.url_root) + body=str(template_object)) return jsonify(resp), 200 diff --git a/app/v2/template/template_schemas.py b/app/v2/template/template_schemas.py index bc405129c..0ad632b9a 100644 --- a/app/v2/template/template_schemas.py +++ b/app/v2/template/template_schemas.py @@ -68,12 +68,11 @@ post_template_preview_response = { } -def create_post_template_preview_response(template, body, url_root): +def create_post_template_preview_response(template, body): return { "id": template.id, "type": template.template_type, "version": template.version, "body": body, - "subject": template.subject, - "uri": "{}v2/template/{}/preview".format(url_root, template.id) + "subject": template.subject } diff --git a/tests/app/v2/template/test_post_template.py b/tests/app/v2/template/test_post_template.py index f99b3ee86..a6c8d542d 100644 --- a/tests/app/v2/template/test_post_template.py +++ b/tests/app/v2/template/test_post_template.py @@ -31,7 +31,6 @@ def test_valid_post_template_returns_200(client, sample_service, tmp_type): resp_json = json.loads(response.get_data(as_text=True)) assert resp_json['id'] == str(template.id) - assert 'v2/template/{}/preview'.format(template.id) in resp_json['uri'] assert 'Dear {}'.format(valid_data['personalisation']['Name']) in resp_json['body']