Rename duplicate ComponentRegistryTest.

Also move registry test to registry.
This commit is contained in:
Emil Stenström 2021-03-10 12:25:28 +01:00
parent b30506087c
commit c0c5a94908
2 changed files with 8 additions and 9 deletions

View file

@ -8,15 +8,7 @@ from .testutils import Django30CompatibleSimpleTestCase as SimpleTestCase
from django_components import component
class ComponentRegistryTest(SimpleTestCase):
def test_register_class_decorator(self):
@component.register("decorated_component")
class TestComponent(component.Component):
pass
self.assertEqual(component.registry.get("decorated_component"), TestComponent)
class ComponentTest(SimpleTestCase):
def test_empty_component(self):
class EmptyComponent(component.Component):
pass

View file

@ -12,6 +12,13 @@ class ComponentRegistryTest(unittest.TestCase):
def setUp(self):
self.registry = component.ComponentRegistry()
def test_register_class_decorator(self):
@component.register("decorated_component")
class TestComponent(component.Component):
pass
self.assertEqual(component.registry.get("decorated_component"), TestComponent)
def test_simple_register(self):
self.registry.register(name="testcomponent", component=MockComponent)
self.assertEqual(