From 7c5644bd22d0041ffeafb7e0e2324fd39284e074 Mon Sep 17 00:00:00 2001 From: Jonathan Green Date: Thu, 20 Jul 2023 09:51:39 -0300 Subject: [PATCH] Make language validation more closely match previous errors. --- core/configuration/library.py | 2 +- tests/api/admin/controller/test_library.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/configuration/library.py b/core/configuration/library.py index 8d60b839b9..f5330e27de 100644 --- a/core/configuration/library.py +++ b/core/configuration/library.py @@ -643,7 +643,7 @@ def validate_language_codes( field_label = cls.get_form_field_label(field.name) raise SettingsValidationError( problem_detail=UNKNOWN_LANGUAGE.detailed( - f"{field_label}: {language} is not a valid language code." + f'"{field_label}": "{language}" is not a valid language code.' ) ) return value diff --git a/tests/api/admin/controller/test_library.py b/tests/api/admin/controller/test_library.py index e8834dd784..95f8ce824e 100644 --- a/tests/api/admin/controller/test_library.py +++ b/tests/api/admin/controller/test_library.py @@ -340,7 +340,7 @@ def test_libraries_post_errors(self, settings_ctrl_fixture): settings_ctrl_fixture.manager.admin_library_settings_controller.process_post() assert excinfo.value.problem_detail.uri == UNKNOWN_LANGUAGE.uri assert ( - "zzz is not a valid language code" + '"zzz" is not a valid language code' in excinfo.value.problem_detail.detail )