diff --git a/artel/artel/settings/base.py b/artel/artel/settings/base.py index 8c4191a..815a400 100644 --- a/artel/artel/settings/base.py +++ b/artel/artel/settings/base.py @@ -68,7 +68,6 @@ INSTALLED_APPS = [ "django.contrib.staticfiles", "rest_framework", "phonenumber_field", - "colorfield", "django_celery_results", "django_celery_beat", "easy_thumbnails", diff --git a/artel/setup/middleware.py b/artel/setup/middleware.py index 14a205b..198e384 100644 --- a/artel/setup/middleware.py +++ b/artel/setup/middleware.py @@ -44,7 +44,7 @@ class CheckShopMiddleware(object): return ProductListPage.objects.filter(url_path__endswith=request.path_info).exists() def __call__(self, request): - config = ComfyConfig.objects.get(active=True) + config = ComfyConfig.objects.filter(active=True).first() if config and not config.shop_enabled and self._check_if_store_request(request): if settings.DEBUG: return HttpResponse( diff --git a/artel/store/tests/test_cart.py b/artel/store/tests/test_cart.py index 5704e43..73a6510 100644 --- a/artel/store/tests/test_cart.py +++ b/artel/store/tests/test_cart.py @@ -3,10 +3,11 @@ from django.urls import reverse from django.conf import settings from store.tests import factories +from artel.tests import BaseComfyTestCaseMixin -class SessionCartTestCase(APITestCase): +class SessionCartTestCase(BaseComfyTestCaseMixin, APITestCase): def setUp(self): super().setUp() diff --git a/artel/store/tests/test_loader.py b/artel/store/tests/test_loader.py index 09b039e..2a4f72d 100644 --- a/artel/store/tests/test_loader.py +++ b/artel/store/tests/test_loader.py @@ -4,9 +4,10 @@ from unittest.mock import patch from store.tests import factories from store.loader import ProductLoader +from artel.tests import BaseComfyTestCaseMixin -class TestProductLoader(TestCase): +class TestProductLoader(BaseComfyTestCaseMixin, TestCase): def setUp(self) -> None: self.category = factories.ProductCategoryFactory() self.template = factories.ProductTemplateFactory(category=self.category) diff --git a/artel/store/tests/test_models.py b/artel/store/tests/test_models.py index 10b81c3..525091e 100644 --- a/artel/store/tests/test_models.py +++ b/artel/store/tests/test_models.py @@ -9,9 +9,10 @@ from django.db import transaction from store.tests import factories from store import models as store_models from mailings.tests.factories import MailTemplateFactory +from artel.tests import BaseComfyTestCaseMixin -class ProductCategoryParamTestCase(TestCase): +class ProductCategoryParamTestCase(BaseComfyTestCaseMixin, TestCase): def setUp(self): super().setUp() self.category = factories.ProductCategoryFactory() @@ -41,7 +42,7 @@ class ProductCategoryParamTestCase(TestCase): self.assertEqual(len(available_values), 3) -class ProductTemplateParamValueTestCase(TestCase): +class ProductTemplateParamValueTestCase(BaseComfyTestCaseMixin, TestCase): def setUp(self): super().setUp() self.category = factories.ProductCategoryFactory() @@ -69,7 +70,7 @@ class ProductTemplateParamValueTestCase(TestCase): self.assertEqual(proper_value, None) -class ProductTestCase(TestCase): +class ProductTestCase(BaseComfyTestCaseMixin, TestCase): def test_template_params_one_value_success(self): product = factories.ProductFactory() @@ -143,7 +144,7 @@ class ProductTestCase(TestCase): self.assertEqual(prod.price, 0) -class OrderProductTestCase(TestCase): +class OrderProductTestCase(BaseComfyTestCaseMixin, TestCase): def setUp(self): super().setUp() self.author = factories.ProductAuthorFactory() @@ -185,7 +186,7 @@ class OrderProductTestCase(TestCase): self.assertEqual(products.count(), 0) -class OrderTestCase(TestCase): +class OrderTestCase(BaseComfyTestCaseMixin, TestCase): def setUp(self) -> None: super().setUp() self.author = factories.ProductAuthorFactory() diff --git a/artel/store/tests/test_views.py b/artel/store/tests/test_views.py index 9f5edfb..b5d559e 100644 --- a/artel/store/tests/test_views.py +++ b/artel/store/tests/test_views.py @@ -12,9 +12,10 @@ from store.tests.factories import ( ProductFactory, ProductTemplateParamValueFactory ) +from artel.tests import BaseComfyTestCaseMixin -class ConfigureProductViewTestCase(TestCase): +class ConfigureProductViewTestCase(BaseComfyTestCaseMixin, TestCase): def setUp(self): super().setUp() @@ -94,5 +95,5 @@ class ConfigureProductViewTestCase(TestCase): self.assertEqual(response.status_code, 302) -class ConfigureProductSummaryViewTestCase(TestCase): +class ConfigureProductSummaryViewTestCase(BaseComfyTestCaseMixin, TestCase): ...