Merge pull request #17 from mfogel/explicit-mixin-test

Test using mixins with settings
This commit is contained in:
Jannis Leidel 2013-03-27 03:56:38 -07:00
commit 5b90971f6d
2 changed files with 37 additions and 0 deletions

View 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',)

View file

@ -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',
))