mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-31 11:49:58 -04:00
Merge pull request #1444 from alphagov/remove-unused-endpoint
Removed service_api_client.get_monthly_notification_stats
This commit is contained in:
@@ -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))
|
||||
|
||||
|
||||
@@ -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']
|
||||
@@ -257,8 +253,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))
|
||||
@@ -343,8 +338,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))
|
||||
|
||||
@@ -375,8 +369,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))
|
||||
|
||||
@@ -495,8 +488,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(
|
||||
@@ -527,8 +519,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(
|
||||
@@ -558,8 +549,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(
|
||||
@@ -589,8 +579,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(
|
||||
@@ -620,8 +609,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(
|
||||
@@ -658,8 +646,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},
|
||||
@@ -884,8 +871,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))
|
||||
|
||||
|
||||
@@ -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,
|
||||
):
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user