mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-16 10:12:32 -05:00
Updated the schema to return reply_to - which is the id and reply_to_text which is the contact_block
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user