Merge "Do not load openstack_dashboard.settings in unit tests"

This commit is contained in:
Zuul
2018-12-29 09:42:46 +00:00
committed by Gerrit Code Review
2 changed files with 9 additions and 9 deletions

View File

@@ -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'

View File

@@ -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