From 890a5cd1e66d1269c2288a1f53a48c056d014ab3 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 19 May 2022 01:43:28 +0200 Subject: [PATCH] rollback testing dsaveguards and add docs --- InvenTree/common/models.py | 6 ------ InvenTree/common/tests.py | 13 ++----------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index 1db60219dd..83773fe48a 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -13,7 +13,6 @@ import hashlib import base64 from secrets import compare_digest from datetime import datetime, timedelta -import warnings from django.apps import apps from django.db import models, transaction @@ -1696,11 +1695,6 @@ class ColorTheme(models.Model): def get_color_themes_choices(cls): """ 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 files_list = [] for file in os.listdir(settings.STATIC_COLOR_THEMES_DIR): diff --git a/InvenTree/common/tests.py b/InvenTree/common/tests.py index 63744ecf40..02ea31c0dc 100644 --- a/InvenTree/common/tests.py +++ b/InvenTree/common/tests.py @@ -680,21 +680,12 @@ class ColorThemeTest(TestCase): """Tests for ColorTheme""" def test_choices(self): + """Test that default choices are returned""" result = ColorTheme.get_color_themes_choices() - - # skip if no themes present - if not result: - return - self.assertIn(('default', 'Default'), result) def test_valid_choice(self): - result = ColorTheme.get_color_themes_choices() - - # skip if no themes present - if not result: - return - + """Check that is_valid_choice works correctly""" # check wrong reference self.assertFalse(ColorTheme.is_valid_choice('abcdd'))