Merge pull request #1267 from alphagov/add-id-for-reply-to

Add id and service_id to the serialize method on ServiceEmailReplyTo
This commit is contained in:
Rebecca Law
2017-09-21 10:56:17 +01:00
committed by GitHub
2 changed files with 6 additions and 0 deletions

View File

@@ -1374,6 +1374,8 @@ class ServiceEmailReplyTo(db.Model):
def serialize(self):
return {
'id': str(self.id),
'service_id': str(self.service_id),
'email_address': self.email_address,
'is_default': self.is_default,
'created_at': self.created_at.strftime(DATETIME_FORMAT),

View File

@@ -2186,11 +2186,15 @@ def test_get_email_reply_to_addresses_with_multiple_email_addresses(client, noti
assert len(json_response) == 2
assert response.status_code == 200
assert json_response[0]['id'] == str(reply_to_a.id)
assert json_response[0]['service_id'] == str(reply_to_a.service_id)
assert json_response[0]['email_address'] == 'test_a@mail.com'
assert json_response[0]['is_default']
assert json_response[0]['created_at']
assert not json_response[0]['updated_at']
assert json_response[1]['id'] == str(reply_to_b.id)
assert json_response[1]['service_id'] == str(reply_to_b.service_id)
assert json_response[1]['email_address'] == 'test_b@mail.com'
assert not json_response[1]['is_default']
assert json_response[1]['created_at']