Rename get_usage_for_all_services to get_data_for_billing_report

That describes what it does more correctly. As it does not include
services with no usage.
This commit is contained in:
Pea Tyczynska
2021-03-08 17:53:16 +00:00
parent 100d47f4e8
commit dd278a0567
2 changed files with 10 additions and 5 deletions

View File

@@ -59,7 +59,8 @@ def validate_date_range_is_within_a_financial_year(start_date, end_date):
@platform_stats_blueprint.route('usage-for-all-services')
def get_usage_for_all_services():
@platform_stats_blueprint.route('data-for-billing-report')
def get_data_for_billing_report():
start_date = request.args.get('start_date')
end_date = request.args.get('end_date')

View File

@@ -126,11 +126,15 @@ def test_validate_date_is_within_a_financial_year_when_input_is_not_a_date(start
assert e.value.status_code == 400
def test_get_usage_for_all_services(notify_db_session, admin_request):
def test_get_data_for_billing_report(notify_db_session, admin_request):
setup = set_up_usage_data(datetime(2019, 5, 1))
response = admin_request.get("platform_stats.get_usage_for_all_services",
response = admin_request.get(
"platform_stats.get_data_for_billing_report",
start_date='2019-05-01',
end_date='2019-06-30')
end_date='2019-06-30'
)
# we set up 5 services, but only 4 returned. service_with_emails was skipped as it had no bills to pay
assert len(response) == 4
assert response[0]["organisation_id"] == str(setup["org_1"].id)
assert response[0]["service_id"] == str(setup["service_1_sms_and_letter"].id)