mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Create platform-stats blueprint
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.
This commit is contained in:
0
tests/app/platform_stats/__init__.py
Normal file
0
tests/app/platform_stats/__init__.py
Normal file
25
tests/app/platform_stats/test_rest.py
Normal file
25
tests/app/platform_stats/test_rest.py
Normal file
@@ -0,0 +1,25 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user