diff --git a/app/notify_client/statistics_api_client.py b/app/notify_client/statistics_api_client.py index e9250b1f9..cc3fdc480 100644 --- a/app/notify_client/statistics_api_client.py +++ b/app/notify_client/statistics_api_client.py @@ -13,15 +13,6 @@ class StatisticsApiClient(BaseAPIClient): self.client_id = app.config['ADMIN_CLIENT_USER_NAME'] self.secret = app.config['ADMIN_CLIENT_SECRET'] - def get_statistics_for_service(self, service_id, limit_days=None): - params = {} - if limit_days is not None: - params['limit_days'] = limit_days - return self.get( - url='/service/{}/notifications-statistics'.format(service_id), - params=params - ) - def get_statistics_for_service_for_day(self, service_id, day): url = '/service/{}/notifications-statistics/day/{}'.format(service_id, day) try: diff --git a/tests/app/main/views/test_accept_invite.py b/tests/app/main/views/test_accept_invite.py index f707e310b..137846f55 100644 --- a/tests/app/main/views/test_accept_invite.py +++ b/tests/app/main/views/test_accept_invite.py @@ -311,7 +311,6 @@ def test_new_invited_user_verifies_and_added_to_service(app_, mock_accept_invite, mock_get_service, mock_get_service_templates, - mock_get_service_statistics, mock_get_template_statistics, mock_get_jobs, mock_has_permissions, diff --git a/tests/app/main/views/test_dashboard.py b/tests/app/main/views/test_dashboard.py index f93f70d7c..dc5a35d80 100644 --- a/tests/app/main/views/test_dashboard.py +++ b/tests/app/main/views/test_dashboard.py @@ -65,7 +65,6 @@ def test_get_started( api_user_active, mock_get_service, mock_get_service_templates_when_no_templates_exist, - mock_get_service_statistics, mock_get_aggregate_service_statistics, mock_get_user, mock_get_user_by_email, @@ -95,7 +94,6 @@ def test_get_started_is_hidden_once_templates_exist( api_user_active, mock_get_service, mock_get_service_templates, - mock_get_service_statistics, mock_get_aggregate_service_statistics, mock_get_user, mock_get_user_by_email, @@ -166,7 +164,6 @@ def test_should_show_all_templates_on_template_statistics_page( api_user_active, mock_get_service, mock_get_service_templates, - mock_get_service_statistics, mock_get_user, mock_get_user_by_email, mock_login, @@ -207,7 +204,6 @@ def test_should_show_recent_jobs_on_dashboard( api_user_active, mock_get_service, mock_get_service_templates, - mock_get_service_statistics, mock_get_aggregate_service_statistics, mock_get_user, mock_get_user_by_email, @@ -253,7 +249,6 @@ def _test_dashboard_menu(mocker, app_, usr, service, permissions): mocker.patch('app.user_api_client.get_user', return_value=usr) mocker.patch('app.user_api_client.get_user_by_email', return_value=usr) mocker.patch('app.service_api_client.get_service', return_value={'data': service}) - mocker.patch('app.statistics_api_client.get_statistics_for_service', return_value={'data': [{}]}) client.login(usr) return client.get(url_for('main.service_dashboard', service_id=service['id'])) @@ -392,7 +387,6 @@ def test_route_for_service_permissions(mocker, mock_get_user, mock_get_service_templates, mock_get_jobs, - mock_get_service_statistics, mock_get_template_statistics, mock_get_detailed_service, mock_get_usage): @@ -435,7 +429,6 @@ def test_service_dashboard_updates_gets_dashboard_totals(mocker, mock_get_template_statistics, mock_get_detailed_service, mock_get_jobs, - mock_get_service_statistics, mock_get_usage): dashboard_totals = mocker.patch('app.main.views.dashboard.get_dashboard_totals', return_value={ 'email': {'requested': 123, 'delivered': 0, 'failed': 0}, diff --git a/tests/app/main/views/test_jobs.py b/tests/app/main/views/test_jobs.py index 2a42ba219..3229e6eab 100644 --- a/tests/app/main/views/test_jobs.py +++ b/tests/app/main/views/test_jobs.py @@ -57,7 +57,6 @@ def test_should_show_page_for_one_job( service_one, active_user_with_permissions, mock_get_service_template, - mock_get_service_statistics, mock_get_job, mocker, mock_get_notifications, @@ -111,7 +110,6 @@ def test_should_show_not_show_csv_download_in_tour( service_one, active_user_with_permissions, mock_get_service_template, - mock_get_service_statistics, mock_get_job, mocker, mock_get_notifications, @@ -147,7 +145,6 @@ def test_should_show_updates_for_one_job_as_json( service_one, active_user_with_permissions, mock_get_notifications, - mock_get_service_statistics, mock_get_job, mocker, fake_uuid @@ -203,7 +200,7 @@ def test_can_show_notifications( service_one, active_user_with_permissions, mock_get_notifications, - mock_get_service_statistics, + mock_get_detailed_service, mocker, message_type, page_title, @@ -263,7 +260,7 @@ def test_should_show_notifications_for_a_service_with_next_previous( service_one, active_user_with_permissions, mock_get_notifications_with_previous_next, - mock_get_service_statistics, + mock_get_detailed_service, mocker ): with app_.test_request_context(): diff --git a/tests/app/main/views/test_sign_out.py b/tests/app/main/views/test_sign_out.py index 6cfe07a38..667a3e332 100644 --- a/tests/app/main/views/test_sign_out.py +++ b/tests/app/main/views/test_sign_out.py @@ -17,7 +17,6 @@ def test_sign_out_user(app_, mock_get_user_by_email, mock_login, mock_get_service_templates, - mock_get_service_statistics, mock_get_jobs, mock_has_permissions, mock_get_template_statistics, diff --git a/tests/app/notify_client/test_statistics_client.py b/tests/app/notify_client/test_statistics_client.py index 200958d2b..db378a729 100644 --- a/tests/app/notify_client/test_statistics_client.py +++ b/tests/app/notify_client/test_statistics_client.py @@ -4,34 +4,6 @@ from datetime import datetime from app.notify_client.statistics_api_client import StatisticsApiClient -def test_notifications_statistics_client_calls_correct_api_endpoint(mocker, api_user_active): - - some_service_id = uuid.uuid4() - expected_url = '/service/{}/notifications-statistics'.format(some_service_id) - - client = StatisticsApiClient() - - mock_get = mocker.patch('app.notify_client.statistics_api_client.StatisticsApiClient.get') - - client.get_statistics_for_service(some_service_id) - - mock_get.assert_called_once_with(url=expected_url, params={}) - - -def test_notifications_statistics_client_calls_correct_api_endpoint_with_params(mocker, api_user_active): - - some_service_id = uuid.uuid4() - expected_url = '/service/{}/notifications-statistics'.format(some_service_id) - - client = StatisticsApiClient() - - mock_get = mocker.patch('app.notify_client.statistics_api_client.StatisticsApiClient.get') - - client.get_statistics_for_service(some_service_id, limit_days=99) - - mock_get.assert_called_once_with(url=expected_url, params={'limit_days': 99}) - - def test_notifications_statistics_client_for_stats_by_day_calls_correct_api_endpoint(mocker, api_user_active): some_service_id = uuid.uuid4() diff --git a/tests/conftest.py b/tests/conftest.py index 4e373241b..17ed7068d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -200,15 +200,6 @@ def mock_delete_service(mocker, mock_get_service): 'app.service_api_client.delete_service', side_effect=_delete) -@pytest.fixture(scope='function') -def mock_get_service_statistics(mocker): - def _create(service_id, limit_days=None): - return {'data': [{}]} - - return mocker.patch( - 'app.statistics_api_client.get_statistics_for_service', side_effect=_create) - - @pytest.fixture(scope='function') def mock_get_service_statistics_for_day(mocker):