From aad183c0ab1b6f06395afd0041fecb2a21a3967a Mon Sep 17 00:00:00 2001 From: Albina Starykova Date: Wed, 25 Sep 2024 16:02:14 +0200 Subject: [PATCH] Update BE tests --- wagtail/admin/tests/test_account_management.py | 18 +++++++++++++++++- wagtail/admin/tests/test_views.py | 4 ++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/wagtail/admin/tests/test_account_management.py b/wagtail/admin/tests/test_account_management.py index 9205e8dd9b0e..70c683f86f79 100644 --- a/wagtail/admin/tests/test_account_management.py +++ b/wagtail/admin/tests/test_account_management.py @@ -232,6 +232,7 @@ def post_form(self, extra_post_data): "locale-current_time_zone": "Europe/London", "theme-theme": "dark", "theme-density": "default", + "theme-contrast": "default", } post_data.update(extra_post_data) return self.client.post(reverse("wagtailadmin_account"), post_data) @@ -480,7 +481,7 @@ def test_change_language_preferences(self): response = self.client.get(reverse("wagtailadmin_home")) self.assertContains( response, - '', + '', ) def test_unset_language_preferences(self): @@ -610,6 +611,21 @@ def test_change_theme_post(self): self.assertEqual(profile.theme, "light") + def test_change_contrast_post(self): + response = self.post_form( + { + "theme-contrast": "high_contrast", + } + ) + + # Check that the user was redirected to the account page + self.assertRedirects(response, reverse("wagtailadmin_account")) + + profile = UserProfile.get_for_user(self.user) + profile.refresh_from_db() + + self.assertEqual(profile.contrast, "high_contrast") + def test_change_density_post(self): response = self.post_form( { diff --git a/wagtail/admin/tests/test_views.py b/wagtail/admin/tests/test_views.py index 2fd6f7718542..f72492845a90 100644 --- a/wagtail/admin/tests/test_views.py +++ b/wagtail/admin/tests/test_views.py @@ -81,7 +81,7 @@ def test_language_code(self): response = self.client.get(reverse("wagtailadmin_login")) self.assertContains( response, - '', + '', ) @override_settings(LANGUAGE_CODE="he") @@ -89,7 +89,7 @@ def test_bidi_language_changes_dir_attribute(self): response = self.client.get(reverse("wagtailadmin_login")) self.assertContains( response, - '', + '', ) @override_settings(