mirror of
https://github.com/django-components/django-components.git
synced 2025-09-26 15:39:08 +00:00
Rename duplicate ComponentRegistryTest.
Also move registry test to registry.
This commit is contained in:
parent
b30506087c
commit
c0c5a94908
2 changed files with 8 additions and 9 deletions
|
@ -8,15 +8,7 @@ from .testutils import Django30CompatibleSimpleTestCase as SimpleTestCase
|
||||||
from django_components import component
|
from django_components import component
|
||||||
|
|
||||||
|
|
||||||
class ComponentRegistryTest(SimpleTestCase):
|
class ComponentTest(SimpleTestCase):
|
||||||
|
|
||||||
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_empty_component(self):
|
def test_empty_component(self):
|
||||||
class EmptyComponent(component.Component):
|
class EmptyComponent(component.Component):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -12,6 +12,13 @@ class ComponentRegistryTest(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.registry = component.ComponentRegistry()
|
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):
|
def test_simple_register(self):
|
||||||
self.registry.register(name="testcomponent", component=MockComponent)
|
self.registry.register(name="testcomponent", component=MockComponent)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue