mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-18 08:02:31 -05:00
Created a platform-stats blueprint and moved the new platform stats endpoint to the new blueprint (it was previously in the service blueprint). Since the original platform stats route and the new platform stats route are now in different blueprints, their view functions can have the same name without any issues.
26 lines
1.0 KiB
Python
26 lines
1.0 KiB
Python
from datetime import date, datetime
|
|
|
|
from freezegun import freeze_time
|
|
|
|
|
|
@freeze_time('2018-06-01')
|
|
def test_get_new_platform_stats_uses_todays_date_if_no_start_or_end_date_is_provided(admin_request, mocker):
|
|
today = datetime.now().date()
|
|
dao_mock = mocker.patch('app.platform_stats.rest.fetch_aggregate_stats_by_date_range_for_all_services')
|
|
mocker.patch('app.service.rest.statistics.format_statistics')
|
|
|
|
admin_request.get('platform_stats.get_new_platform_stats')
|
|
|
|
dao_mock.assert_called_once_with(start_date=today, end_date=today)
|
|
|
|
|
|
def test_get_new_platform_stats_can_filter_by_date(admin_request, mocker):
|
|
start_date = date(2017, 1, 1)
|
|
end_date = date(2018, 1, 1)
|
|
dao_mock = mocker.patch('app.platform_stats.rest.fetch_aggregate_stats_by_date_range_for_all_services')
|
|
mocker.patch('app.service.rest.statistics.format_statistics')
|
|
|
|
admin_request.get('platform_stats.get_new_platform_stats', start_date=start_date, end_date=end_date)
|
|
|
|
dao_mock.assert_called_once_with(start_date=start_date, end_date=end_date)
|