diff --git a/.ds.baseline b/.ds.baseline index 69663da27..54a20d34c 100644 --- a/.ds.baseline +++ b/.ds.baseline @@ -161,7 +161,7 @@ "filename": "app/config.py", "hashed_secret": "577a4c667e4af8682ca431857214b3a920883efc", "is_verified": false, - "line_number": 123, + "line_number": 121, "is_secret": false } ], @@ -634,5 +634,5 @@ } ] }, - "generated_at": "2025-07-22T17:07:31Z" + "generated_at": "2025-07-31T11:49:07Z" } diff --git a/app/config.py b/app/config.py index 51aedfffa..e226a0149 100644 --- a/app/config.py +++ b/app/config.py @@ -16,9 +16,7 @@ class Config(object): API_PUBLIC_WS_URL = getenv("API_PUBLIC_WS_URL", "localhost") ADMIN_BASE_URL = getenv("ADMIN_BASE_URL", "http://localhost:6012") - HEADER_COLOUR = ( - "#81878b" # mix of dark-grey and mid-grey - ) + HEADER_COLOUR = "#81878b" # mix of dark-grey and mid-grey LOGO_CDN_DOMAIN = ( "static-logos.notifications.service.gov.uk" # TODO use our own CDN ) diff --git a/app/main/views/manage_users.py b/app/main/views/manage_users.py index 686672f2b..92cb94982 100644 --- a/app/main/views/manage_users.py +++ b/app/main/views/manage_users.py @@ -73,7 +73,9 @@ def invite_user(service_id, user_id=None): else: user_to_invite = None - service_has_email_auth = current_service.has_permission(ServicePermission.EMAIL_AUTH) + service_has_email_auth = current_service.has_permission( + ServicePermission.EMAIL_AUTH + ) if not service_has_email_auth: form.login_authentication.data = "sms_auth" @@ -116,7 +118,9 @@ def invite_user(service_id, user_id=None): @main.route("/services//users/", methods=["GET", "POST"]) @user_has_permissions(ServicePermission.MANAGE_SERVICE) def edit_user_permissions(service_id, user_id): - service_has_email_auth = current_service.has_permission(ServicePermission.EMAIL_AUTH) + service_has_email_auth = current_service.has_permission( + ServicePermission.EMAIL_AUTH + ) user = current_service.get_team_member(user_id) mobile_number = None diff --git a/app/main/views/notifications.py b/app/main/views/notifications.py index 0ad680d1c..59390741d 100644 --- a/app/main/views/notifications.py +++ b/app/main/views/notifications.py @@ -94,7 +94,9 @@ def view_notification(service_id, notification_id, error_message=None): updated_at=notification["sent_at"], help=get_help_argument(), notification_id=notification["id"], - can_receive_inbound=(current_service.has_permission(ServicePermission.INBOUND_SMS)), + can_receive_inbound=( + current_service.has_permission(ServicePermission.INBOUND_SMS) + ), sent_with_test_key=(notification.get("key_type") == KEY_TYPE_TEST), back_link=back_link, ) diff --git a/app/main/views/send.py b/app/main/views/send.py index 3294d0909..a1c4a9788 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -560,7 +560,9 @@ def _check_messages(service_id, template_id, upload_id, preview_row, **kwargs): max_errors_shown=50, guestlist=allow_list, remaining_messages=remaining_messages, - allow_international_sms=current_service.has_permission(ServicePermission.INTERNATIONAL_SMS), + allow_international_sms=current_service.has_permission( + ServicePermission.INTERNATIONAL_SMS + ), ) if request.args.get("from_test"): diff --git a/app/templates/components/radios.html b/app/templates/components/radios.html index 22489e289..52df8aa07 100644 --- a/app/templates/components/radios.html +++ b/app/templates/components/radios.html @@ -1,7 +1,7 @@ {% from "components/select-input.html" import select, select_list, select_nested, select_wrapper, select_input %} -{% macro radios(field, hint=None, disable=[], option_hints={}, hide_legend=False, inline=False) %} - {{ select(field, hint, disable, option_hints, hide_legend, input="radio", inline=inline) }} +{% macro radios(field, hint=None, disable=[], option_hints={}, hide_legend=False, inline=False, legend_style="text") %} + {{ select(field, hint, disable, option_hints, hide_legend, legend_style=legend_style, input="radio", inline=inline) }} {% endmacro %} diff --git a/app/templates/components/select-input.html b/app/templates/components/select-input.html index 0af11021c..fb39f7370 100644 --- a/app/templates/components/select-input.html +++ b/app/templates/components/select-input.html @@ -45,7 +45,11 @@
{% if hide_legend %}{% endif %} - {{ field.label.text|safe }} + {% if legend_style == 'usa-legend--large' %} +

{{ field.label.text|safe }}

+ {% else %} + {{ field.label.text|safe }} + {% endif %} {% if hide_legend %}
{% endif %} {% if hint %} diff --git a/app/templates/views/api/keys/create.html b/app/templates/views/api/keys/create.html index 260264bef..40c546e76 100644 --- a/app/templates/views/api/keys/create.html +++ b/app/templates/views/api/keys/create.html @@ -20,17 +20,15 @@ {% call form_wrapper() %} {{ form.key_name }} -
- {% if current_service.trial_mode %} - {{ radios( - form.key_type, - disable=['normal'], - option_hints={'normal': 'Not available because your service is in trial mode'|safe} - ) }} - {% else %} - {{ radios(form.key_type) }} - {% endif %} -
+ {% if current_service.trial_mode %} + {{ radios( + form.key_type, + disable=['normal'], + option_hints={'normal': 'Not available because your service is in trial mode'|safe} + ) }} + {% else %} + {{ radios(form.key_type) }} + {% endif %} {{ page_footer('Continue') }} {% endcall %} diff --git a/app/templates/views/templates/set-sender.html b/app/templates/views/templates/set-sender.html index 5995343fe..5d420c037 100644 --- a/app/templates/views/templates/set-sender.html +++ b/app/templates/views/templates/set-sender.html @@ -16,7 +16,7 @@
{% call form_wrapper() %} - {{ radios(form.sender) }} + {{ radios(form.sender, legend_style='usa-legend--large') }}
{{ page_footer('Continue') }}
diff --git a/app/templates/views/templates/set-template-sender.html b/app/templates/views/templates/set-template-sender.html index 9936b851c..09bfc2ef7 100644 --- a/app/templates/views/templates/set-template-sender.html +++ b/app/templates/views/templates/set-template-sender.html @@ -18,7 +18,7 @@
{% call form_wrapper() %} - {{ radios(form.sender) }} + {{ radios(form.sender, legend_style='usa-legend--large') }}
{{ page_footer('Continue') }}
diff --git a/app/utils/user_permissions.py b/app/utils/user_permissions.py index b221fbb18..d543b2358 100644 --- a/app/utils/user_permissions.py +++ b/app/utils/user_permissions.py @@ -4,7 +4,10 @@ from app.enums import ServicePermission permission_mappings = { # TODO: consider turning off email-sending permissions during SMS pilot - ServicePermission.SEND_MESSAGES: [ServicePermission.SEND_TEXTS, ServicePermission.SEND_EMAILS], + ServicePermission.SEND_MESSAGES: [ + ServicePermission.SEND_TEXTS, + ServicePermission.SEND_EMAILS, + ], ServicePermission.MANAGE_TEMPLATES: [ServicePermission.MANAGE_TEMPLATES], ServicePermission.MANAGE_SERVICE: [ ServicePermission.MANAGE_USERS, diff --git a/tests/app/main/views/service_settings/test_service_setting_permissions.py b/tests/app/main/views/service_settings/test_service_setting_permissions.py index ba8c522e1..0307b680a 100644 --- a/tests/app/main/views/service_settings/test_service_setting_permissions.py +++ b/tests/app/main/views/service_settings/test_service_setting_permissions.py @@ -202,7 +202,11 @@ def test_service_setting_link_toggles_index_error( ("permissions", "permissions_text", "visible"), [ ("sms", "inbound SMS", True), - (ServicePermission.INBOUND_SMS, "inbound SMS", False), # no sms parent permission + ( + ServicePermission.INBOUND_SMS, + "inbound SMS", + False, + ), # no sms parent permission # also test no permissions set ("", "inbound SMS", False), ], diff --git a/tests/app/main/views/test_api_integration.py b/tests/app/main/views/test_api_integration.py index ecfb9a196..fda7170a4 100644 --- a/tests/app/main/views/test_api_integration.py +++ b/tests/app/main/views/test_api_integration.py @@ -182,10 +182,12 @@ def test_should_show_create_api_key_page( for index, option in enumerate(expected_options): item = page.select(".usa-radio")[index] if type(option) is tuple: - assert normalize_spaces(item.select_one(".usa-label").text) == option[0] + assert ( + normalize_spaces(item.select_one(".usa-radio__label").text) == option[0] + ) assert normalize_spaces(item.select_one(".usa-hint").text) == option[1] else: - assert normalize_spaces(item.select_one(".usa-label").text) == option + assert normalize_spaces(item.select_one(".usa-radio__label").text) == option def test_should_create_api_key_with_type_normal( diff --git a/tests/app/main/views/test_dashboard.py b/tests/app/main/views/test_dashboard.py index f468e6e34..5d0b040e9 100644 --- a/tests/app/main/views/test_dashboard.py +++ b/tests/app/main/views/test_dashboard.py @@ -966,7 +966,7 @@ def test_menu_manage_service( ServicePermission.VIEW_ACTIVITY, ServicePermission.MANAGE_TEMPLATES, ServicePermission.MANAGE_USERS, - ServicePermission.MANAGE_SETTINGS + ServicePermission.MANAGE_SETTINGS, ], ) page = str(page) diff --git a/tests/app/utils/test_user.py b/tests/app/utils/test_user.py index a4d97f6db..47c761ec8 100644 --- a/tests/app/utils/test_user.py +++ b/tests/app/utils/test_user.py @@ -36,7 +36,11 @@ def test_permissions( request.view_args.update({"service_id": "foo"}) api_user_active["permissions"] = { - "foo": [ServicePermission.MANAGE_USERS, ServicePermission.MANAGE_TEMPLATES, ServicePermission.MANAGE_SETTINGS] + "foo": [ + ServicePermission.MANAGE_USERS, + ServicePermission.MANAGE_TEMPLATES, + ServicePermission.MANAGE_SETTINGS, + ] } api_user_active["services"] = ["foo", "bar"] @@ -66,7 +70,11 @@ def test_permissions_forbidden( request.view_args.update({"service_id": "foo"}) api_user_active["permissions"] = { - "foo": [ServicePermission.MANAGE_USERS, ServicePermission.MANAGE_TEMPLATES, ServicePermission.MANAGE_SETTINGS] + "foo": [ + ServicePermission.MANAGE_USERS, + ServicePermission.MANAGE_TEMPLATES, + ServicePermission.MANAGE_SETTINGS, + ] } api_user_active["services"] = ["foo", "bar"] @@ -179,7 +187,11 @@ def test_user_with_no_permissions_to_service_goes_to_templates( api_user_active, ): api_user_active["permissions"] = { - "foo": [ServicePermission.MANAGE_USERS, ServicePermission.MANAGE_TEMPLATES, ServicePermission.MANAGE_SETTINGS] + "foo": [ + ServicePermission.MANAGE_USERS, + ServicePermission.MANAGE_TEMPLATES, + ServicePermission.MANAGE_SETTINGS, + ] } api_user_active["services"] = ["foo", "bar"] client_request.login(api_user_active)