mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-24 00:06:16 -04:00
Merge pull request #2284 from alphagov/add-count-pages-flag-to-service-notifications
Don't return pagination links for API Message log requests
This commit is contained in:
@@ -909,6 +909,16 @@ def test_should_return_notifications_including_one_offs_by_default(sample_user,
|
||||
assert len(include_one_offs_by_default) == 2
|
||||
|
||||
|
||||
def test_should_not_count_pages_when_given_a_flag(sample_user, sample_template):
|
||||
create_notification(sample_template)
|
||||
notification = create_notification(sample_template)
|
||||
|
||||
pagination = get_notifications_for_service(sample_template.service_id, count_pages=False, page_size=1)
|
||||
assert len(pagination.items) == 1
|
||||
assert pagination.total is None
|
||||
assert pagination.items[0].id == notification.id
|
||||
|
||||
|
||||
def test_get_notifications_created_by_api_or_csv_are_returned_correctly_excluding_test_key_notifications(
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
|
||||
@@ -1407,6 +1407,28 @@ def test_get_only_api_created_notifications_for_service(
|
||||
assert resp['notifications'][0]['id'] == str(without_job.id)
|
||||
|
||||
|
||||
def test_get_notifications_for_service_without_page_count(
|
||||
admin_request,
|
||||
sample_job,
|
||||
sample_template,
|
||||
sample_user,
|
||||
):
|
||||
create_notification(sample_template)
|
||||
without_job = create_notification(sample_template)
|
||||
|
||||
resp = admin_request.get(
|
||||
'service.get_all_notifications_for_service',
|
||||
service_id=sample_template.service_id,
|
||||
page_size=1,
|
||||
include_jobs=False,
|
||||
include_one_off=False,
|
||||
count_pages=False
|
||||
)
|
||||
assert len(resp['notifications']) == 1
|
||||
assert resp['total'] is None
|
||||
assert resp['notifications'][0]['id'] == str(without_job.id)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('should_prefix', [
|
||||
True,
|
||||
False,
|
||||
|
||||
Reference in New Issue
Block a user