Change context behavior setting to enum

This commit is contained in:
Dylan Castillo 2024-01-15 11:11:31 +01:00 committed by Emil Stenström
parent 8971849922
commit 560b721523
5 changed files with 48 additions and 9 deletions

20
tests/test_settings.py Normal file
View file

@ -0,0 +1,20 @@
from .django_test_setup import * # NOQA
from .testutils import Django30CompatibleSimpleTestCase as SimpleTestCase
from django.conf import settings
class ValidateWrongContextBehaviorValueTestCase(SimpleTestCase):
def setUp(self) -> None:
settings.COMPONENTS["context_behavior"] = "invalid_value"
return super().setUp()
def tearDown(self) -> None:
del settings.COMPONENTS["context_behavior"]
return super().tearDown()
def test_valid_context_behavior(self):
from django_components.app_settings import app_settings
with self.assertRaises(ValueError):
app_settings.CONTEXT_BEHAVIOR.value