Add test for pagination behaviour

We already have a test case for over 50 results, but this adds
one for 50 (ie a single page of results or less)
This commit is contained in:
David McDonald
2021-12-09 18:21:41 +00:00
parent ec6ed3958c
commit 6ac4e67f78

View File

@@ -2269,6 +2269,23 @@ def test_search_for_notification_by_to_field_returns_next_link_if_more_than_50(
assert 'page=2' in response_json['links']['last']
def test_search_for_notification_by_to_field_returns_no_next_link_if_50_or_less(
client, sample_template
):
for _ in range(50):
create_notification(sample_template, to_field='+447700900855', normalised_to='447700900855')
response = client.get(
'/service/{}/notifications?to={}&template_type={}'.format(sample_template.service_id, '+447700900855', 'sms'),
headers=[create_admin_authorization_header()]
)
assert response.status_code == 200
response_json = json.loads(response.get_data(as_text=True))
assert len(response_json['notifications']) == 50
assert response_json['links'] == {}
def test_search_for_notification_by_to_field_for_letter(
client,
notify_db,