From 35eff630ffc82e35414e69f85e1c38f3909bd2b0 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sun, 14 Jan 2024 15:39:02 +0800 Subject: [PATCH] updated theming tests --- cookbook/tests/other/test_theming.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cookbook/tests/other/test_theming.py b/cookbook/tests/other/test_theming.py index 1407a6e237..68e90e99c6 100644 --- a/cookbook/tests/other/test_theming.py +++ b/cookbook/tests/other/test_theming.py @@ -14,6 +14,7 @@ def test_theming_function(space_1, u1_s1): request.user = auth.get_user(u1_s1) request.space = space_1 + # defaults apply without setting anything (user preference is automatically created with these defaults) assert get_theming_values(request)['theme'] == static('themes/tandoor.min.css') assert get_theming_values(request)['nav_bg_color'] == '#ddbf86' assert get_theming_values(request)['nav_text_class'] == 'navbar-light' @@ -26,6 +27,7 @@ def test_theming_function(space_1, u1_s1): user.userpreference.nav_sticky = False user.userpreference.save() + # user values apply if only those are present assert get_theming_values(request)['theme'] == static('themes/tandoor_dark.min.css') assert get_theming_values(request)['nav_bg_color'] == '#ffffff' assert get_theming_values(request)['nav_text_class'] == 'navbar-dark' @@ -36,6 +38,14 @@ def test_theming_function(space_1, u1_s1): space_1.nav_text_color = UserPreference.DARK space_1.save() + # space settings apply when set assert get_theming_values(request)['theme'] == static('themes/bootstrap.min.css') assert get_theming_values(request)['nav_bg_color'] == '#000000' assert get_theming_values(request)['nav_text_class'] == 'navbar-light' + + user.userspace_set.all().delete() + + # default user settings should apply when user has no space + assert get_theming_values(request)['nav_bg_color'] == '#ddbf86' + assert get_theming_values(request)['nav_text_class'] == 'navbar-light' + assert get_theming_values(request)['nav_logo'] == static('assets/brand_logo.png')