fixed tests by adding comfyconfig in base settings
ci/woodpecker/push/build Pipeline was successful Szczegóły
ci/woodpecker/pr/build Pipeline failed Szczegóły

feature/optionalization
mtyton 2023-09-23 13:31:39 +02:00
rodzic c6e3aed91e
commit 8f4d3b1128
6 zmienionych plików z 14 dodań i 11 usunięć

Wyświetl plik

@ -68,7 +68,6 @@ INSTALLED_APPS = [
"django.contrib.staticfiles",
"rest_framework",
"phonenumber_field",
"colorfield",
"django_celery_results",
"django_celery_beat",
"easy_thumbnails",

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -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):
...