mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-22 14:11:27 -04:00
remove get_statistics_for_service_for_day from codebase
two down, three to go
This commit is contained in:
@@ -22,16 +22,6 @@ class StatisticsApiClient(BaseAPIClient):
|
||||
params=params
|
||||
)
|
||||
|
||||
def get_statistics_for_service_for_day(self, service_id, day):
|
||||
url = '/service/{}/notifications-statistics/day/{}'.format(service_id, day)
|
||||
try:
|
||||
return self.get(url=url)['data']
|
||||
except HTTPError as e:
|
||||
if e.status_code == 404:
|
||||
return None
|
||||
else:
|
||||
raise e
|
||||
|
||||
def get_7_day_aggregate_for_service(self, service_id, date_from=None, week_count=None):
|
||||
params = {}
|
||||
if date_from is not None:
|
||||
|
||||
@@ -30,19 +30,3 @@ def test_notifications_statistics_client_calls_correct_api_endpoint_with_params(
|
||||
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()
|
||||
today = datetime.today().date().strftime('%Y-%m-%d')
|
||||
|
||||
expected_url = '/service/{}/notifications-statistics/day/{}'.format(some_service_id, today)
|
||||
|
||||
client = StatisticsApiClient()
|
||||
|
||||
mock_get = mocker.patch('app.notify_client.statistics_api_client.StatisticsApiClient.get')
|
||||
|
||||
client.get_statistics_for_service_for_day(some_service_id, today)
|
||||
|
||||
mock_get.assert_called_once_with(url=expected_url)
|
||||
|
||||
@@ -225,26 +225,6 @@ def mock_get_service_statistics(mocker):
|
||||
'app.statistics_api_client.get_statistics_for_service', side_effect=_create)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_get_service_statistics_for_day(mocker):
|
||||
|
||||
stats = {'day': datetime.today().date().strftime('%Y-%m-%d'),
|
||||
'emails_delivered': 0,
|
||||
'sms_requested': 0,
|
||||
'sms_delivered': 0,
|
||||
'sms_failed': 0,
|
||||
'emails_requested': 0,
|
||||
'emails_failed': 0,
|
||||
'service': fake_uuid,
|
||||
'id': fake_uuid}
|
||||
|
||||
def _stats(service_id, day):
|
||||
return {'data': stats}
|
||||
|
||||
return mocker.patch(
|
||||
'app.statistics_api_client.get_statistics_for_service_for_day', side_effect=_stats)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_get_aggregate_service_statistics(mocker):
|
||||
def _create(service_id, limit_days=None):
|
||||
|
||||
Reference in New Issue
Block a user