mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
rollback testing dsaveguards and add docs
This commit is contained in:
parent
38f8e9c9ab
commit
890a5cd1e6
@ -13,7 +13,6 @@ import hashlib
|
|||||||
import base64
|
import base64
|
||||||
from secrets import compare_digest
|
from secrets import compare_digest
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import warnings
|
|
||||||
|
|
||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
@ -1696,11 +1695,6 @@ class ColorTheme(models.Model):
|
|||||||
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 """
|
||||||
|
|
||||||
# Check that settings exsist
|
|
||||||
if not os.path.exists(settings.STATIC_COLOR_THEMES_DIR):
|
|
||||||
warnings.warn('No Theme-data found')
|
|
||||||
return []
|
|
||||||
|
|
||||||
# Get files list from css/color-themes/ folder
|
# Get files list from css/color-themes/ folder
|
||||||
files_list = []
|
files_list = []
|
||||||
for file in os.listdir(settings.STATIC_COLOR_THEMES_DIR):
|
for file in os.listdir(settings.STATIC_COLOR_THEMES_DIR):
|
||||||
|
@ -680,21 +680,12 @@ class ColorThemeTest(TestCase):
|
|||||||
"""Tests for ColorTheme"""
|
"""Tests for ColorTheme"""
|
||||||
|
|
||||||
def test_choices(self):
|
def test_choices(self):
|
||||||
|
"""Test that default choices are returned"""
|
||||||
result = ColorTheme.get_color_themes_choices()
|
result = ColorTheme.get_color_themes_choices()
|
||||||
|
|
||||||
# skip if no themes present
|
|
||||||
if not result:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.assertIn(('default', 'Default'), result)
|
self.assertIn(('default', 'Default'), result)
|
||||||
|
|
||||||
def test_valid_choice(self):
|
def test_valid_choice(self):
|
||||||
result = ColorTheme.get_color_themes_choices()
|
"""Check that is_valid_choice works correctly"""
|
||||||
|
|
||||||
# skip if no themes present
|
|
||||||
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