refactor: Prepare autodiscover and template loader for v1 (#533)

This commit is contained in:
Juro Oravec 2024-07-29 20:27:35 +02:00 committed by GitHub
parent b1bd430a07
commit 8cb88558f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 643 additions and 552 deletions

View file

@ -9,15 +9,14 @@ from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponse
from django.template import Context, Template, TemplateSyntaxError
# isort: off
from .django_test_setup import * # NOQA
from .testutils import BaseTestCase, parametrize_context_behavior
# isort: on
from django_components import component, types
from django_components.slots import SlotRef
from .django_test_setup import setup_test_config
from .testutils import BaseTestCase, parametrize_context_behavior
setup_test_config({"autodiscover": False})
class ComponentTest(BaseTestCase):
class ParentComponent(component.Component):
@ -55,11 +54,10 @@ class ComponentTest(BaseTestCase):
context["unique_variable"] = new_variable
return context
@classmethod
def setUpClass(cls):
super().setUpClass()
component.registry.register(name="parent_component", component=cls.ParentComponent)
component.registry.register(name="variable_display", component=cls.VariableDisplay)
def setUp(self):
super().setUp()
component.registry.register(name="parent_component", component=self.ParentComponent)
component.registry.register(name="variable_display", component=self.VariableDisplay)
@parametrize_context_behavior(["django", "isolated"])
def test_empty_component(self):