mirror of
https://github.com/django-components/django-components.git
synced 2025-08-03 22:08:17 +00:00
parent
997ed52bb6
commit
dc9f1b46b2
10 changed files with 106 additions and 9 deletions
30
tests/test_autodiscover.py
Normal file
30
tests/test_autodiscover.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
from django.urls import include, path
|
||||
|
||||
# isort: off
|
||||
from .django_test_setup import * # noqa
|
||||
from .testutils import Django30CompatibleSimpleTestCase as SimpleTestCase
|
||||
|
||||
# isort: on
|
||||
|
||||
|
||||
from django_components import autodiscover, component
|
||||
|
||||
urlpatterns = [
|
||||
path("", include("tests.components.urls")),
|
||||
]
|
||||
|
||||
|
||||
class TestAutodiscover(SimpleTestCase):
|
||||
def setUp(self):
|
||||
settings.SETTINGS_MODULE = "tests.test_autodiscover" # noqa
|
||||
|
||||
def tearDown(self) -> None:
|
||||
del settings.SETTINGS_MODULE # noqa
|
||||
|
||||
def test_autodiscover_with_components_as_views(self):
|
||||
try:
|
||||
autodiscover()
|
||||
except component.AlreadyRegistered:
|
||||
self.fail(
|
||||
"Autodiscover should not raise AlreadyRegistered exception"
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue