mirror of
https://github.com/django-components/django-components.git
synced 2025-08-31 03:07:19 +00:00
Don't allow registering the same component twice.
This commit is contained in:
parent
313852ce21
commit
00bd40aaaf
2 changed files with 11 additions and 0 deletions
|
@ -22,3 +22,8 @@ class ComponentRegistryTest(unittest.TestCase):
|
|||
self.registry._registry.items(),
|
||||
[("testcomponent", MockComponent), ("testcomponent2", MockComponent)]
|
||||
)
|
||||
|
||||
def test_prevent_registering_twice(self):
|
||||
self.registry.register(name="testcomponent", component=MockComponent)
|
||||
with self.assertRaises(component.AlreadyRegistered):
|
||||
self.registry.register(name="testcomponent", component=MockComponent)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue