Use arguments rather than passing around a dict

This makes it harder to write code which will pass tests but fail in
real life.
This commit is contained in:
Chris Hill-Scott
2021-03-11 10:52:03 +00:00
parent fce4082fff
commit 25a6788d66
4 changed files with 37 additions and 13 deletions

View File

@@ -1,3 +1,5 @@
from datetime import date
from app.notify_client.performance_dashboard_api_client import (
PerformanceDashboardAPIClient,
)
@@ -6,7 +8,13 @@ from app.notify_client.performance_dashboard_api_client import (
def test_get_aggregate_platform_stats(mocker):
client = PerformanceDashboardAPIClient()
mock = mocker.patch.object(client, 'get')
params_dict = {'start_date': '2021-03-01', 'end_date': '2021-03-31'}
client.get_performance_dashboard_stats(params_dict=params_dict)
mock.assert_called_once_with('/performance-dashboard', params=params_dict)
client.get_performance_dashboard_stats(
start_date=date(2021, 3, 1),
end_date=date(2021, 3, 31),
)
mock.assert_called_once_with('/performance-dashboard', params={
'start_date': '2021-03-01',
'end_date': '2021-03-31'
})