From 16f3aafa104d0f1369df36f4b8c79b0554c93f0f Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Wed, 23 Aug 2017 17:07:42 +0100 Subject: [PATCH] Removed service_api_client.get_monthly_notification_stats because it is not being used anymore. --- app/notify_client/service_api_client.py | 6 ---- tests/app/main/views/test_dashboard.py | 42 +++++++++---------------- tests/app/main/views/test_sign_out.py | 1 - tests/conftest.py | 9 ------ 4 files changed, 14 insertions(+), 44 deletions(-) diff --git a/app/notify_client/service_api_client.py b/app/notify_client/service_api_client.py index dc84afb40..ede5ae3c6 100644 --- a/app/notify_client/service_api_client.py +++ b/app/notify_client/service_api_client.py @@ -228,12 +228,6 @@ class ServiceAPIClient(NotifyAdminAPIClient): def get_service_history(self, service_id): return self.get('/service/{0}/history'.format(service_id)) - def get_yearly_sms_unit_count_and_cost(self, service_id, year=None): - return self.get( - '/service/{0}/yearly-sms-billable-units'.format(service_id), - params=dict(year=year) - ) - def get_monthly_notification_stats(self, service_id, year): return self.get(url='/service/{}/notifications/monthly?year={}'.format(service_id, year)) diff --git a/tests/app/main/views/test_dashboard.py b/tests/app/main/views/test_dashboard.py index 4a0074bd2..8e3c9f2c8 100644 --- a/tests/app/main/views/test_dashboard.py +++ b/tests/app/main/views/test_dashboard.py @@ -48,8 +48,7 @@ def test_get_started( mock_get_jobs, mock_get_detailed_service, mock_get_usage, - mock_get_inbound_sms_summary, - mock_get_yearly_sms_unit_count_and_cost + mock_get_inbound_sms_summary ): mock_template_stats = mocker.patch('app.template_statistics_client.get_template_statistics_for_service', return_value=copy.deepcopy(stub_template_stats)) @@ -68,8 +67,7 @@ def test_get_started_is_hidden_once_templates_exist( mock_get_jobs, mock_get_detailed_service, mock_get_usage, - mock_get_inbound_sms_summary, - mock_get_yearly_sms_unit_count_and_cost + mock_get_inbound_sms_summary ): mock_template_stats = mocker.patch('app.template_statistics_client.get_template_statistics_for_service', return_value=copy.deepcopy(stub_template_stats)) @@ -88,8 +86,7 @@ def test_inbound_messages_not_visible_to_service_without_permissions( mock_get_detailed_service, mock_get_template_statistics, mock_get_usage, - mock_get_inbound_sms_summary, - mock_get_yearly_sms_unit_count_and_cost + mock_get_inbound_sms_summary ): service_one['permissions'] = [] @@ -116,8 +113,7 @@ def test_inbound_messages_shows_count_of_messages( mock_get_template_statistics, mock_get_usage, inbound_summary_mock, - expected_text, - mock_get_yearly_sms_unit_count_and_cost + expected_text ): service_one['permissions'] = ['inbound_sms'] @@ -255,8 +251,7 @@ def test_should_show_recent_templates_on_dashboard( mock_get_jobs, mock_get_detailed_service, mock_get_usage, - mock_get_inbound_sms_summary, - mock_get_yearly_sms_unit_count_and_cost + mock_get_inbound_sms_summary ): mock_template_stats = mocker.patch('app.template_statistics_client.get_template_statistics_for_service', return_value=copy.deepcopy(stub_template_stats)) @@ -341,8 +336,7 @@ def test_should_show_upcoming_jobs_on_dashboard( mock_get_detailed_service, mock_get_jobs, mock_get_usage, - mock_get_inbound_sms_summary, - mock_get_yearly_sms_unit_count_and_cost + mock_get_inbound_sms_summary ): response = logged_in_client.get(url_for('main.service_dashboard', service_id=SERVICE_ONE_ID)) @@ -373,8 +367,7 @@ def test_should_show_recent_jobs_on_dashboard( mock_get_detailed_service, mock_get_jobs, mock_get_usage, - mock_get_inbound_sms_summary, - mock_get_yearly_sms_unit_count_and_cost + mock_get_inbound_sms_summary ): response = logged_in_client.get(url_for('main.service_dashboard', service_id=SERVICE_ONE_ID)) @@ -493,8 +486,7 @@ def test_menu_send_messages( mock_get_template_statistics, mock_get_detailed_service, mock_get_usage, - mock_get_inbound_sms_summary, - mock_get_yearly_sms_unit_count_and_cost + mock_get_inbound_sms_summary ): with app_.test_request_context(): resp = _test_dashboard_menu( @@ -525,8 +517,7 @@ def test_menu_manage_service( mock_get_template_statistics, mock_get_detailed_service, mock_get_usage, - mock_get_inbound_sms_summary, - mock_get_yearly_sms_unit_count_and_cost + mock_get_inbound_sms_summary ): with app_.test_request_context(): resp = _test_dashboard_menu( @@ -556,8 +547,7 @@ def test_menu_manage_api_keys( mock_get_template_statistics, mock_get_detailed_service, mock_get_usage, - mock_get_inbound_sms_summary, - mock_get_yearly_sms_unit_count_and_cost + mock_get_inbound_sms_summary ): with app_.test_request_context(): resp = _test_dashboard_menu( @@ -587,8 +577,7 @@ def test_menu_all_services_for_platform_admin_user( mock_get_template_statistics, mock_get_detailed_service, mock_get_usage, - mock_get_inbound_sms_summary, - mock_get_yearly_sms_unit_count_and_cost + mock_get_inbound_sms_summary ): with app_.test_request_context(): resp = _test_dashboard_menu( @@ -618,8 +607,7 @@ def test_route_for_service_permissions( mock_get_template_statistics, mock_get_detailed_service, mock_get_usage, - mock_get_inbound_sms_summary, - mock_get_yearly_sms_unit_count_and_cost + mock_get_inbound_sms_summary ): with app_.test_request_context(): validate_route_permission( @@ -656,8 +644,7 @@ def test_service_dashboard_updates_gets_dashboard_totals( mock_get_detailed_service, mock_get_jobs, mock_get_usage, - mock_get_inbound_sms_summary, - mock_get_yearly_sms_unit_count_and_cost + mock_get_inbound_sms_summary ): mocker.patch('app.main.views.dashboard.get_dashboard_totals', return_value={ 'email': {'requested': 123, 'delivered': 0, 'failed': 0}, @@ -882,8 +869,7 @@ def test_should_show_all_jobs_with_valid_statuses( mock_get_service_templates_when_no_templates_exist, mock_get_jobs, mock_get_usage, - mock_get_inbound_sms_summary, - mock_get_yearly_sms_unit_count_and_cost + mock_get_inbound_sms_summary ): logged_in_client.get(url_for('main.service_dashboard', service_id=SERVICE_ONE_ID)) diff --git a/tests/app/main/views/test_sign_out.py b/tests/app/main/views/test_sign_out.py index c17f5fa4a..3b550f377 100644 --- a/tests/app/main/views/test_sign_out.py +++ b/tests/app/main/views/test_sign_out.py @@ -23,7 +23,6 @@ def test_sign_out_user( mock_has_permissions, mock_get_template_statistics, mock_get_detailed_service, - mock_get_yearly_sms_unit_count_and_cost, mock_get_usage, mock_get_inbound_sms_summary, ): diff --git a/tests/conftest.py b/tests/conftest.py index 1004022dd..167d2d598 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1532,15 +1532,6 @@ def mock_get_usage(mocker, service_one, fake_uuid): 'app.billing_api_client.get_service_usage', side_effect=_get_usage) -@pytest.fixture(scope='function') -def mock_get_yearly_sms_unit_count_and_cost(mocker, service_one, fake_uuid): - def _get_usage(service_id, year=None): - return {"billable_sms_units": 100, "total_cost": 200.0} - - return mocker.patch( - 'app.service_api_client.get_yearly_sms_unit_count_and_cost', side_effect=_get_usage) - - @pytest.fixture(scope='function') def mock_get_billable_units(mocker): def _get_usage(service_id, year):