mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-20 14:29:25 -04:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user