From c833a760707c1ca673b43892ba3c4f0ea33d2473 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Tue, 13 Feb 2018 17:12:00 +0000 Subject: [PATCH 1/3] The admin app is looking for reply_to_text not reply_to. This will fix the admin app and not affect the public api calls for template versions, they don't use the marshmallow schema --- app/schemas.py | 2 +- tests/app/template/test_rest_history.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/schemas.py b/app/schemas.py index 17dea94bd..0adb9eea3 100644 --- a/app/schemas.py +++ b/app/schemas.py @@ -346,7 +346,7 @@ class TemplateSchema(BaseTemplateSchema): class TemplateHistorySchema(BaseSchema): - reply_to = fields.Method("get_reply_to", allow_none=True) + reply_to_text = fields.Method("get_reply_to", allow_none=True) created_by = fields.Nested(UserSchema, only=['id', 'name', 'email_address'], dump_only=True) created_at = field_for(models.Template, 'created_at', format='%Y-%m-%d %H:%M:%S.%f') diff --git a/tests/app/template/test_rest_history.py b/tests/app/template/test_rest_history.py index c26c4abc8..4bf97c020 100644 --- a/tests/app/template/test_rest_history.py +++ b/tests/app/template/test_rest_history.py @@ -111,4 +111,4 @@ def test_update_template_reply_to_updates_history(client, sample_letter_template hist_json_resp = json.loads(resp.get_data(as_text=True)) assert 'service_letter_contact_id' not in hist_json_resp['data'] - assert hist_json_resp['data']['reply_to'] == str(letter_contact.id) + assert hist_json_resp['data']['reply_to_text'] == str(letter_contact.id) From 94162bc1bf774b23ec888cefa04687dc9d7b8382 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Wed, 14 Feb 2018 11:20:09 +0000 Subject: [PATCH 2/3] Updated the schema to return reply_to - which is the id and reply_to_text which is the contact_block --- app/schemas.py | 6 +++++- tests/app/template/test_rest_history.py | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/schemas.py b/app/schemas.py index 0adb9eea3..b5172c9d9 100644 --- a/app/schemas.py +++ b/app/schemas.py @@ -346,7 +346,8 @@ class TemplateSchema(BaseTemplateSchema): class TemplateHistorySchema(BaseSchema): - reply_to_text = fields.Method("get_reply_to", allow_none=True) + reply_to = fields.Method("get_reply_to", allow_none=True) + reply_to_text = fields.Method("get_reply_to_text", allow_none=True) created_by = fields.Nested(UserSchema, only=['id', 'name', 'email_address'], dump_only=True) created_at = field_for(models.Template, 'created_at', format='%Y-%m-%d %H:%M:%S.%f') @@ -354,6 +355,9 @@ class TemplateHistorySchema(BaseSchema): def get_reply_to(self, template): return template.reply_to + def get_reply_to_text(self, template): + return template.get_reply_to_text() + class Meta: model = models.TemplateHistory diff --git a/tests/app/template/test_rest_history.py b/tests/app/template/test_rest_history.py index 4bf97c020..f4c638a4e 100644 --- a/tests/app/template/test_rest_history.py +++ b/tests/app/template/test_rest_history.py @@ -111,4 +111,5 @@ def test_update_template_reply_to_updates_history(client, sample_letter_template hist_json_resp = json.loads(resp.get_data(as_text=True)) assert 'service_letter_contact_id' not in hist_json_resp['data'] - assert hist_json_resp['data']['reply_to_text'] == str(letter_contact.id) + assert hist_json_resp['data']['reply_to'] == str(letter_contact.id) + assert hist_json_resp['data']['reply_to_text'] == letter_contact.contact_block From 4820365b1330611929a479e4bedb6956d145310f Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Thu, 15 Feb 2018 09:47:28 +0000 Subject: [PATCH 3/3] Rename migration file so that the force db migration part of the deploy does not trigger --- ...anisation_service.py => 0164_add_organisation_to_service.py} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename migrations/versions/{0164_add_organisation_service.py => 0164_add_organisation_to_service.py} (95%) diff --git a/migrations/versions/0164_add_organisation_service.py b/migrations/versions/0164_add_organisation_to_service.py similarity index 95% rename from migrations/versions/0164_add_organisation_service.py rename to migrations/versions/0164_add_organisation_to_service.py index 6e96ce7b4..14a7e5596 100644 --- a/migrations/versions/0164_add_organisation_service.py +++ b/migrations/versions/0164_add_organisation_to_service.py @@ -1,6 +1,6 @@ """ -Revision ID: 0164_add_organisation_service +Revision ID: 0164_add_organisation_to_service Revises: 0163_add_new_org_model Create Date: 2018-02-09 17:58:34.617206