mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
skip css if not available
This commit is contained in:
parent
eac6456949
commit
b87f44dbfc
@ -1694,6 +1694,9 @@ class ColorTheme(models.Model):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_color_themes_choices(cls):
|
def get_color_themes_choices(cls):
|
||||||
""" Get all color themes from static folder """
|
""" Get all color themes from static folder """
|
||||||
|
if settings.TESTING and not os.path.exists(settings.STATIC_COLOR_THEMES_DIR):
|
||||||
|
logger.error('Theme directory does not exsist')
|
||||||
|
return []
|
||||||
|
|
||||||
# Get files list from css/color-themes/ folder
|
# Get files list from css/color-themes/ folder
|
||||||
files_list = []
|
files_list = []
|
||||||
|
@ -682,10 +682,20 @@ class ColorThemeTest(TestCase):
|
|||||||
def test_choices(self):
|
def test_choices(self):
|
||||||
"""Test that default choices are returned"""
|
"""Test that default choices are returned"""
|
||||||
result = ColorTheme.get_color_themes_choices()
|
result = ColorTheme.get_color_themes_choices()
|
||||||
|
|
||||||
|
# skip
|
||||||
|
if not result:
|
||||||
|
return
|
||||||
self.assertIn(('default', 'Default'), result)
|
self.assertIn(('default', 'Default'), result)
|
||||||
|
|
||||||
def test_valid_choice(self):
|
def test_valid_choice(self):
|
||||||
"""Check that is_valid_choice works correctly"""
|
"""Check that is_valid_choice works correctly"""
|
||||||
|
result = ColorTheme.get_color_themes_choices()
|
||||||
|
|
||||||
|
# skip
|
||||||
|
if not result:
|
||||||
|
return
|
||||||
|
|
||||||
# check wrong reference
|
# check wrong reference
|
||||||
self.assertFalse(ColorTheme.is_valid_choice('abcdd'))
|
self.assertFalse(ColorTheme.is_valid_choice('abcdd'))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user