Match on partial email addresses in search

Users expect the search to work on partial email addresses ‘similar to
Gov.Pay’. We can’t have a situation where Pay are doing something better
than us 😜
This commit is contained in:
Chris Hill-Scott
2018-03-06 11:38:40 +00:00
parent 4767379fc7
commit 209d75efd9
2 changed files with 16 additions and 1 deletions

View File

@@ -1751,6 +1751,21 @@ def test_dao_get_notifications_by_to_field_search_is_not_case_sensitive(sample_t
assert notification.id in notification_ids
def test_dao_get_notifications_by_to_field_matches_partial_emails(sample_template):
notification_1 = create_notification(
template=sample_template, to_field='jack@gmail.com', normalised_to='jack@gmail.com'
)
notification_2 = create_notification(
template=sample_template, to_field='jacque@gmail.com', normalised_to='jacque@gmail.com'
)
results = dao_get_notifications_by_to_field(notification_1.service_id, 'ack')
notification_ids = [notification.id for notification in results]
assert len(results) == 1
assert notification_1.id in notification_ids
assert notification_2.id not in notification_ids
@pytest.mark.parametrize('to', [
'not@email', '123'
])