diff --git a/tests/app/service/test_rest.py b/tests/app/service/test_rest.py index e3a4ea141..179d9383a 100644 --- a/tests/app/service/test_rest.py +++ b/tests/app/service/test_rest.py @@ -1046,34 +1046,33 @@ def test_get_all_notifications_for_service_in_order(notify_api, notify_db, notif ] ) def test_get_all_notifications_for_service_including_ones_made_by_jobs( - notify_api, + client, notify_db, notify_db_session, sample_service, include_from_test_key, expected_count_of_notifications ): - with notify_api.test_request_context(), notify_api.test_client() as client: - with_job = sample_notification_with_job(notify_db, notify_db_session, service=sample_service) - without_job = create_sample_notification(notify_db, notify_db_session, service=sample_service) - from_test_api_key = create_sample_notification( - notify_db, notify_db_session, service=sample_service, key_type=KEY_TYPE_TEST - ) + with_job = sample_notification_with_job(notify_db, notify_db_session, service=sample_service) + without_job = create_sample_notification(notify_db, notify_db_session, service=sample_service) + from_test_api_key = create_sample_notification( + notify_db, notify_db_session, service=sample_service, key_type=KEY_TYPE_TEST + ) - auth_header = create_authorization_header() + auth_header = create_authorization_header() - response = client.get( - path='/service/{}/notifications?include_from_test_key={}'.format( - sample_service.id, include_from_test_key - ), - headers=[auth_header] - ) + response = client.get( + path='/service/{}/notifications?include_from_test_key={}'.format( + sample_service.id, include_from_test_key + ), + headers=[auth_header] + ) - resp = json.loads(response.get_data(as_text=True)) - assert len(resp['notifications']) == expected_count_of_notifications - assert resp['notifications'][0]['to'] == with_job.to - assert resp['notifications'][1]['to'] == without_job.to - assert response.status_code == 200 + resp = json.loads(response.get_data(as_text=True)) + assert len(resp['notifications']) == expected_count_of_notifications + assert resp['notifications'][0]['to'] == with_job.to + assert resp['notifications'][1]['to'] == without_job.to + assert response.status_code == 200 def test_get_only_api_created_notifications_for_service(