mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-06 01:08:25 -04:00
Merge pull request #2097 from alphagov/ft-usage-page-as-default
Rename the method for usage and update the tests.
This commit is contained in:
@@ -141,7 +141,7 @@ def template_usage(service_id):
|
|||||||
@main.route("/services/<service_id>/monthly-billing-usage")
|
@main.route("/services/<service_id>/monthly-billing-usage")
|
||||||
@login_required
|
@login_required
|
||||||
@user_has_permissions('manage_service')
|
@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)
|
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)
|
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,
|
selected_year=year,
|
||||||
years=get_tuples_of_financial_years(
|
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,
|
start=current_financial_year - 1,
|
||||||
end=current_financial_year + 1,
|
end=current_financial_year + 1,
|
||||||
),
|
),
|
||||||
@@ -172,7 +172,7 @@ def usage(service_id):
|
|||||||
@main.route("/services/<service_id>/usage")
|
@main.route("/services/<service_id>/usage")
|
||||||
@login_required
|
@login_required
|
||||||
@user_has_permissions('manage_service')
|
@user_has_permissions('manage_service')
|
||||||
def ft_usage(service_id):
|
def usage(service_id):
|
||||||
year, current_financial_year = requested_and_current_financial_year(request)
|
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)
|
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,
|
selected_year=year,
|
||||||
years=get_tuples_of_financial_years(
|
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,
|
start=current_financial_year - 1,
|
||||||
end=current_financial_year + 1,
|
end=current_financial_year + 1,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ def test_excluded_navigation_items_are_properly_defined(navigation_instance):
|
|||||||
])
|
])
|
||||||
def test_all_endpoints_are_covered(navigation_instance):
|
def test_all_endpoints_are_covered(navigation_instance):
|
||||||
for endpoint in all_endpoints:
|
for endpoint in all_endpoints:
|
||||||
if not endpoint == 'main.ft_usage':
|
if not endpoint == 'main.monthly_billing_usage':
|
||||||
assert endpoint in (
|
assert endpoint in (
|
||||||
navigation_instance.endpoints_with_navigation +
|
navigation_instance.endpoints_with_navigation +
|
||||||
navigation_instance.endpoints_without_navigation
|
navigation_instance.endpoints_without_navigation
|
||||||
|
|||||||
@@ -2194,7 +2194,7 @@ def mock_get_usage(mocker, service_one, fake_uuid):
|
|||||||
]
|
]
|
||||||
|
|
||||||
return mocker.patch(
|
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')
|
@pytest.fixture(scope='function')
|
||||||
@@ -2300,7 +2300,7 @@ def mock_get_billable_units(mocker):
|
|||||||
]
|
]
|
||||||
|
|
||||||
return mocker.patch(
|
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')
|
@pytest.fixture(scope='function')
|
||||||
@@ -2318,7 +2318,7 @@ def mock_get_future_usage(mocker, service_one, fake_uuid):
|
|||||||
]
|
]
|
||||||
|
|
||||||
return mocker.patch(
|
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')
|
@pytest.fixture(scope='function')
|
||||||
@@ -2327,7 +2327,7 @@ def mock_get_future_billable_units(mocker):
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
return mocker.patch(
|
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')
|
@pytest.fixture(scope='function')
|
||||||
|
|||||||
Reference in New Issue
Block a user