diff --git a/app/config.py b/app/config.py index c19849a7e..201517a09 100644 --- a/app/config.py +++ b/app/config.py @@ -96,6 +96,7 @@ class Development(Config): class Test(Development): DEBUG = True + TESTING = True STATSD_ENABLED = True WTF_CSRF_ENABLED = False CSV_UPLOAD_BUCKET_NAME = 'test-notifications-csv-upload' diff --git a/app/notify_client/notification_api_client.py b/app/notify_client/notification_api_client.py index bea8506d9..1f026eb9d 100644 --- a/app/notify_client/notification_api_client.py +++ b/app/notify_client/notification_api_client.py @@ -55,5 +55,5 @@ class NotificationApiClient(NotifyAdminAPIClient): params=params ) - def get_notification(self, service_id, notification_id):m + def get_notification(self, service_id, notification_id): return self.get(url='/service/{}/notifications/{}'.format(service_id, notification_id)) diff --git a/tests/app/main/views/test_notifications.py b/tests/app/main/views/test_notifications.py index 07a2d867c..c03b4969a 100644 --- a/tests/app/main/views/test_notifications.py +++ b/tests/app/main/views/test_notifications.py @@ -39,10 +39,8 @@ def test_notification_status_page_shows_details( ): page = client_request.get( 'main.view_notification', - endpoint_kwargs={ - 'service_id': service_one['id'], - 'notification_id': fake_uuid - } + service_id=service_one['id'], + notification_id=fake_uuid ) assert page.find('div', {'class': 'sms-message-wrapper'}).text.strip() == 'service one: template content' @@ -72,10 +70,8 @@ def test_notification_status_page_shows_correct_numbers( page = client_request.get( 'main.view_notification', - endpoint_kwargs={ - 'service_id': service_one['id'], - 'notification_id': fake_uuid - } + service_id=service_one['id'], + notification_id=fake_uuid ) big_numbers = page.find_all('div', {'class': 'big-number-number'}) diff --git a/tests/conftest.py b/tests/conftest.py index 2b90a9e6e..fed2c3c1f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,4 @@ + import os from datetime import date, datetime, timedelta from unittest.mock import Mock @@ -1702,26 +1703,27 @@ def os_environ(): os.environ = old_env -@pytest.fixture @pytest.fixture def client_request(logged_in_client): class ClientRequest: @staticmethod - def get(endpoint, endpoint_kwargs=None, expected_status=200, follow_redirects=False): + def get(endpoint, _expected_status=200, _follow_redirects=False, **endpoint_kwargs): resp = logged_in_client.get( - url_for(endpoint, **(endpoint_kwargs or {})) + url_for(endpoint, **(endpoint_kwargs or {})), + follow_redirects=_follow_redirects, ) - assert resp.status_code == expected_status + assert resp.status_code == _expected_status return BeautifulSoup(resp.data.decode('utf-8'), 'html.parser') @staticmethod - def post(endpoint, endpoint_kwargs=None, data=None, expected_status=302, follow_redirects=False): + def post(endpoint, _data=None, _expected_status=302, _follow_redirects=False, **endpoint_kwargs): resp = logged_in_client.post( url_for(endpoint, **(endpoint_kwargs or {})), - data + data=_data, + follow_redirects=_follow_redirects, ) - assert resp.status_code == expected_status + assert resp.status_code == _expected_status return BeautifulSoup(resp.data.decode('utf-8'), 'html.parser') return ClientRequest