diff --git a/openstack_dashboard/test/settings.py b/openstack_dashboard/test/settings.py index 7e149124ce..e519380d2b 100644 --- a/openstack_dashboard/test/settings.py +++ b/openstack_dashboard/test/settings.py @@ -21,6 +21,7 @@ from horizon.utils import secret_key from openstack_dashboard import enabled from openstack_dashboard import exceptions +from openstack_dashboard import theme_settings from openstack_dashboard.utils import settings as settings_utils # this is used to protect from client XSS attacks, but it's worth @@ -60,14 +61,8 @@ AVAILABLE_THEMES = [ 'themes/material' ), ] - -SELECTABLE_THEMES = [ - ( - 'default', - pgettext_lazy('Default style theme', 'Default'), - 'themes/default' - ), -] +AVAILABLE_THEMES, SELECTABLE_THEMES, DEFAULT_THEME = \ + theme_settings.get_available_themes(AVAILABLE_THEMES, 'default', None) # Theme Static Directory THEME_COLLECTION_DIR = 'themes' diff --git a/openstack_dashboard/test/unit/test_themes.py b/openstack_dashboard/test/unit/test_themes.py index 06f29ae0a6..12c2816996 100644 --- a/openstack_dashboard/test/unit/test_themes.py +++ b/openstack_dashboard/test/unit/test_themes.py @@ -10,7 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. -from openstack_dashboard import settings +from django.conf import settings +from django.test.utils import override_settings + from openstack_dashboard.templatetags import themes from openstack_dashboard.test import helpers as test @@ -23,6 +25,9 @@ class SelectableThemeTest(test.TestCase): # 'available' list self.assertEqual(selectable, available) + @override_settings(SELECTABLE_THEMES=[ + ('default', 'Default', 'themes/default'), + ]) def test_selectable_override(self): selectable = themes.themes() available = themes.settings.AVAILABLE_THEMES