Added the mapping between notification and reply to email to the database and persisted the mapping when the request is received by the end point. the end point also checks if the reply to email id exists and if not returns an error. Also added tests to test the functionality.

This commit is contained in:
Richard Chapman
2017-10-05 11:33:20 +01:00
parent 68d8999b1c
commit d2168b7985
7 changed files with 171 additions and 13 deletions

View File

@@ -347,3 +347,26 @@ def test_check_service_email_reply_to_id_where_service_id_is_not_found(sample_se
check_service_email_reply_to_id(fake_uuid, fake_uuid)
assert e.value.status_code == 400
assert e.value.message == 'email_reply_to_id does not exist in database'
def test_check_service_email_reply_to_id_where_reply_to_id_is_none():
assert check_service_email_reply_to_id(None, None) is None
def test_check_service_email_reply_to_id_where_reply_to_id_is_not_found(sample_service, fake_uuid):
with pytest.raises(BadRequestError) as e:
check_service_email_reply_to_id(sample_service.id, fake_uuid)
assert e.value.status_code == 400
assert e.value.message == 'email_reply_to_id does not exist in database'
def test_check_service_email_reply_to_id_where_reply_to_id_is_found(sample_service):
reply_to_email = create_reply_to_email(sample_service, 'test@test.com')
assert check_service_email_reply_to_id(sample_service.id, reply_to_email.id) is None
def test_check_service_email_reply_to_id_where_service_id_is_not_found(sample_service, fake_uuid):
with pytest.raises(BadRequestError) as e:
check_service_email_reply_to_id(fake_uuid, fake_uuid)
assert e.value.status_code == 400
assert e.value.message == 'email_reply_to_id does not exist in database'