From ce8bdea9be06287b3192e05f3933b413ee76beca Mon Sep 17 00:00:00 2001 From: Ben Thorner Date: Fri, 29 Apr 2022 17:27:37 +0100 Subject: [PATCH] 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. --- tests/conftest.py | 67 +++++++---------------------------------------- 1 file changed, 9 insertions(+), 58 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 2daef0e7b..a47b311a8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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(