Rename the method for usage and update the tests.

This commit is contained in:
Rebecca Law
2018-05-29 15:31:40 +01:00
parent ec03ec1e60
commit 6bdb8b7210
3 changed files with 9 additions and 9 deletions

View File

@@ -141,7 +141,7 @@ def template_usage(service_id):
@main.route("/services/<service_id>/monthly-billing-usage")
@login_required
@user_has_permissions('manage_service')
def usage(service_id):
def monthly_billing_usage(service_id):
year, current_financial_year = requested_and_current_financial_year(request)
free_sms_allowance = billing_api_client.get_free_sms_fragment_limit_for_year(service_id, year)
@@ -160,7 +160,7 @@ def usage(service_id):
)),
selected_year=year,
years=get_tuples_of_financial_years(
partial(url_for, '.usage', service_id=service_id),
partial(url_for, '.monthly_billing_usage', service_id=service_id),
start=current_financial_year - 1,
end=current_financial_year + 1,
),
@@ -172,7 +172,7 @@ def usage(service_id):
@main.route("/services/<service_id>/usage")
@login_required
@user_has_permissions('manage_service')
def ft_usage(service_id):
def usage(service_id):
year, current_financial_year = requested_and_current_financial_year(request)
free_sms_allowance = billing_api_client.get_free_sms_fragment_limit_for_year(service_id, year)
@@ -191,7 +191,7 @@ def ft_usage(service_id):
)),
selected_year=year,
years=get_tuples_of_financial_years(
partial(url_for, '.ft_usage', service_id=service_id),
partial(url_for, '.usage', service_id=service_id),
start=current_financial_year - 1,
end=current_financial_year + 1,
),

View File

@@ -71,7 +71,7 @@ def test_excluded_navigation_items_are_properly_defined(navigation_instance):
])
def test_all_endpoints_are_covered(navigation_instance):
for endpoint in all_endpoints:
if not endpoint == 'main.ft_usage':
if not endpoint == 'main.monthly_billing_usage':
assert endpoint in (
navigation_instance.endpoints_with_navigation +
navigation_instance.endpoints_without_navigation

View File

@@ -2194,7 +2194,7 @@ def mock_get_usage(mocker, service_one, fake_uuid):
]
return mocker.patch(
'app.billing_api_client.get_service_usage', side_effect=_get_usage)
'app.billing_api_client.get_service_usage_ft', side_effect=_get_usage)
@pytest.fixture(scope='function')
@@ -2300,7 +2300,7 @@ def mock_get_billable_units(mocker):
]
return mocker.patch(
'app.billing_api_client.get_billable_units', side_effect=_get_usage)
'app.billing_api_client.get_billable_units_ft', side_effect=_get_usage)
@pytest.fixture(scope='function')
@@ -2318,7 +2318,7 @@ def mock_get_future_usage(mocker, service_one, fake_uuid):
]
return mocker.patch(
'app.billing_api_client.get_service_usage', side_effect=_get_usage)
'app.billing_api_client.get_service_usage_ft', side_effect=_get_usage)
@pytest.fixture(scope='function')
@@ -2327,7 +2327,7 @@ def mock_get_future_billable_units(mocker):
return []
return mocker.patch(
'app.billing_api_client.get_billable_units', side_effect=_get_usage)
'app.billing_api_client.get_billable_units_ft', side_effect=_get_usage)
@pytest.fixture(scope='function')