From 7f7f55304139bbd7fe0146da71cec39e168e4a6e Mon Sep 17 00:00:00 2001 From: Andrew Shumway Date: Wed, 27 Dec 2023 14:14:22 -0700 Subject: [PATCH] Fix sms allowance switching to live --- app/main/views/service_settings.py | 8 ++++++++ tests/conftest.py | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/app/main/views/service_settings.py b/app/main/views/service_settings.py index feb1e4388..1cac1410c 100644 --- a/app/main/views/service_settings.py +++ b/app/main/views/service_settings.py @@ -124,6 +124,14 @@ def service_switch_live(service_id): if form.validate_on_submit(): current_service.update_status(live=form.enabled.data) + if form.enabled.data is True: + billing_api_client.create_or_update_free_sms_fragment_limit( + service_id, 250000 + ) + else: + billing_api_client.create_or_update_free_sms_fragment_limit( + service_id, 40000 + ) return redirect(url_for(".service_settings", service_id=service_id)) return render_template( diff --git a/tests/conftest.py b/tests/conftest.py index 9bab089f8..b64b4243c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2323,6 +2323,10 @@ def client_request(logged_in_client, mocker, service_one): # noqa (C901 too com "app.service_api_client.get_global_notification_count", side_effect=_get ) + mocker.patch( + "app.billing_api_client.create_or_update_free_sms_fragment_limit", autospec=True + ) + class ClientRequest: @staticmethod @contextmanager