diff --git a/app/main/views/dashboard.py b/app/main/views/dashboard.py index f5f38087a..87a013547 100644 --- a/app/main/views/dashboard.py +++ b/app/main/views/dashboard.py @@ -322,6 +322,14 @@ def get_dashboard_partials(service_id): free_sms_allowance = billing_api_client.get_free_sms_fragment_limit_for_year( current_service.id, ) + # These 2 calls will update the dashboard sms allowance count while in trial mode. + billing_api_client.get_monthly_usage_for_service( + service_id, get_current_financial_year() + ) + billing_api_client.create_or_update_free_sms_fragment_limit( + service_id, free_sms_fragment_limit=free_sms_allowance + ) + yearly_usage = billing_api_client.get_annual_usage_for_service( service_id, get_current_financial_year(), diff --git a/tests/app/main/views/test_dashboard.py b/tests/app/main/views/test_dashboard.py index 9703a2de5..10d686a98 100644 --- a/tests/app/main/views/test_dashboard.py +++ b/tests/app/main/views/test_dashboard.py @@ -1386,7 +1386,9 @@ def test_route_for_service_permissions( mock_has_no_jobs, mock_get_template_statistics, mock_get_service_statistics, + mock_get_monthly_usage_for_service, mock_get_annual_usage_for_service, + mock_create_or_update_free_sms_fragment_limit, mock_get_free_sms_fragment_limit, mock_get_inbound_sms_summary, ): diff --git a/tests/conftest.py b/tests/conftest.py index ec4ff8ad1..1724f0234 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2327,6 +2327,8 @@ def client_request(logged_in_client, mocker, service_one): # noqa (C901 too com "app.billing_api_client.create_or_update_free_sms_fragment_limit", autospec=True ) + mocker.patch("app.billing_api_client.get_monthly_usage_for_service", autospec=True) + class ClientRequest: @staticmethod @contextmanager