mirror of
https://github.com/jazzband/django-configurations.git
synced 2026-03-16 22:20:27 +00:00
Test using mixins with settings
This commit is contained in:
parent
c5c0feff9f
commit
0f83894494
2 changed files with 37 additions and 0 deletions
25
configurations/tests/settings/mixin_inheritance.py
Normal file
25
configurations/tests/settings/mixin_inheritance.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
from configurations import Settings
|
||||
|
||||
|
||||
class Mixin1(object):
|
||||
|
||||
@property
|
||||
def TEMPLATE_CONTEXT_PROCESSORS(self):
|
||||
return super(Mixin1, self).TEMPLATE_CONTEXT_PROCESSORS + (
|
||||
'some_app.context_processors.processor1',)
|
||||
|
||||
|
||||
class Mixin2(object):
|
||||
|
||||
@property
|
||||
def TEMPLATE_CONTEXT_PROCESSORS(self):
|
||||
return super(Mixin2, self).TEMPLATE_CONTEXT_PROCESSORS + (
|
||||
'some_app.context_processors.processor2',)
|
||||
|
||||
|
||||
class Inheritance(Mixin2, Mixin1, Settings):
|
||||
|
||||
@property
|
||||
def TEMPLATE_CONTEXT_PROCESSORS(self):
|
||||
return super(Inheritance, self).TEMPLATE_CONTEXT_PROCESSORS + (
|
||||
'some_app.context_processors.processorbase',)
|
||||
|
|
@ -28,3 +28,15 @@ class InheritanceTests(TestCase):
|
|||
'configurations.tests.settings.base.test_callback',
|
||||
'configurations.tests.settings.base.test_callback',
|
||||
))
|
||||
|
||||
@patch.dict(os.environ, clear=True,
|
||||
DJANGO_CONFIGURATION='Inheritance',
|
||||
DJANGO_SETTINGS_MODULE='configurations.tests.settings.mixin_inheritance')
|
||||
def test_inherited3(self):
|
||||
from configurations.tests.settings import mixin_inheritance
|
||||
self.assertEquals(mixin_inheritance.TEMPLATE_CONTEXT_PROCESSORS,
|
||||
global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
|
||||
'some_app.context_processors.processor1',
|
||||
'some_app.context_processors.processor2',
|
||||
'some_app.context_processors.processorbase',
|
||||
))
|
||||
|
|
|
|||
Loading…
Reference in a new issue