Fix inaccurate test data for monthly usage API

It has never been possible to get multiple rows for the same month
and rate. This was making it hard to switch to the new API fields,
which will require some manual calculations. I've added the billing
units together in the remaining data so the tests still pass.

I've also moved the "April" row to the end as it was out-of-order
with all the others: it's the _start_ of the financial year.
This commit is contained in:
Ben Thorner
2022-04-29 17:27:37 +01:00
parent 4ab795ad68
commit ce8bdea9be

View File

@@ -2358,74 +2358,18 @@ def mock_get_annual_usage_for_service(mocker, service_one, fake_uuid):
def mock_get_monthly_usage_for_service(mocker):
def _get_usage(service_id, year):
return [
{
'month': 'April',
'notification_type': 'sms',
'rate': 0.017,
'billing_units': 249500,
'postage': 'none',
},
{
'month': 'April',
'notification_type': 'sms',
'rate': 0.017,
'billing_units': 100,
'postage': 'none',
},
{
'month': 'April',
'notification_type': 'sms',
'rate': 0.017,
'billing_units': 200,
'postage': 'none',
},
{
'month': 'April',
'notification_type': 'sms',
'rate': 0.017,
'billing_units': 60,
'postage': 'none',
},
{
'month': 'March',
'notification_type': 'sms',
'rate': 0.017,
'billing_units': 1000,
'postage': 'none',
},
{
'month': 'March',
'notification_type': 'sms',
'rate': 0.017,
'billing_units': 100,
'postage': 'none',
},
{
'month': 'March',
'notification_type': 'sms',
'rate': 0.017,
'billing_units': 100,
'postage': 'none',
},
{
'month': 'March',
'notification_type': 'sms',
'rate': 0.017,
'billing_units': 30,
'billing_units': 1230,
'postage': 'none',
},
{
'month': 'February',
'notification_type': 'sms',
'rate': 0.0165,
'billing_units': 1000,
'postage': 'none',
},
{
'month': 'February',
'notification_type': 'sms',
'rate': 0.0165,
'billing_units': 100,
'billing_units': 1100,
'postage': 'none',
},
{
@@ -2456,6 +2400,13 @@ def mock_get_monthly_usage_for_service(mocker):
'billing_units': 7,
'postage': 'rest-of-world',
},
{
'month': 'April',
'notification_type': 'sms',
'rate': 0.017,
'billing_units': 249860,
'postage': 'none',
},
]
return mocker.patch(