<s> from __future__ import absolute_import <EOL> from django . conf import settings <EOL> from django . core . exceptions import ImproperlyConfigured <EOL> from django . test import TestCase <EOL> from django . test . utils import override_settings <EOL> from . models import ( AppConf , TestConf , PrefixConf , <EOL> YetAnotherPrefixConf , SeparateConf , <EOL> ProxyConf , CustomHolderConf , custom_holder ) <EOL> class TestConfTests ( TestCase ) : <EOL> def test_basic ( self ) : <EOL> self . assertEqual ( TestConf . _meta . prefix , '<STR_LIT>' ) <EOL> def test_simple ( self ) : <EOL> self . assertTrue ( hasattr ( settings , '<STR_LIT>' ) ) <EOL> self . assertEqual ( settings . TESTS_SIMPLE_VALUE , True ) <EOL> def test_configured ( self ) : <EOL> self . assertTrue ( hasattr ( settings , '<STR_LIT>' ) ) <EOL> self . assertEqual ( settings . TESTS_CONFIGURED_VALUE , '<STR_LIT>' ) <EOL> def test_configure_method ( self ) : <EOL> self . assertTrue ( hasattr ( settings , '<STR_LIT>' ) ) <EOL> self . assertEqual ( settings . TESTS_CONFIGURE_METHOD_VALUE , True ) <EOL> def test_init_kwargs ( self ) : <EOL> custom_conf = TestConf ( CUSTOM_VALUE = '<STR_LIT>' ) <EOL> self . assertEqual ( custom_conf . CUSTOM_VALUE , '<STR_LIT>' ) <EOL> self . assertEqual ( settings . TESTS_CUSTOM_VALUE , '<STR_LIT>' ) <EOL> self . assertRaises ( AttributeError , <EOL> lambda : custom_conf . TESTS_CUSTOM_VALUE ) <EOL> custom_conf . CUSTOM_VALUE_SETATTR = '<STR_LIT>' <EOL> self . assertEqual ( settings . TESTS_CUSTOM_VALUE_SETATTR , '<STR_LIT>' ) <EOL> custom_conf . custom_value_lowercase = '<STR_LIT>' <EOL> self . assertRaises ( AttributeError , <EOL> lambda : settings . custom_value_lowercase ) <EOL> def test_init_kwargs_with_prefix ( self ) : <EOL> custom_conf = TestConf ( TESTS_CUSTOM_VALUE2 = '<STR_LIT>' ) <EOL> self . assertEqual ( custom_conf . TESTS_CUSTOM_VALUE2 , '<STR_LIT>' ) <EOL> self . assertEqual ( settings . TESTS_CUSTOM_VALUE2 , '<STR_LIT>' ) <EOL> def test_proxy ( self ) : <EOL> custom_conf = ProxyConf ( CUSTOM_VALUE3 = '<STR_LIT>' ) <EOL> self . assertEqual ( custom_conf . CUSTOM_VALUE3 , '<STR_LIT>' ) <EOL> self . assertEqual ( settings . TESTS_CUSTOM_VALUE3 , '<STR_LIT>' ) <EOL> self . assertEqual ( custom_conf . TESTS_CUSTOM_VALUE3 , '<STR_LIT>' ) <EOL> self . assertTrue ( '<STR_LIT>' in custom_conf . INSTALLED_APPS ) <EOL> def test_dir_members ( self ) : <EOL> custom_conf = TestConf ( ) <EOL> self . assertTrue ( '<STR_LIT>' in dir ( settings ) ) <EOL> self . assertTrue ( '<STR_LIT>' in dir ( custom_conf ) ) <EOL> self . assertFalse ( '<STR_LIT>' in dir ( custom_conf ) ) <EOL> def test_custom_holder ( self ) : <EOL> CustomHolderConf ( ) <EOL> self . assertTrue ( hasattr ( custom_holder , '<STR_LIT>' ) ) <EOL> self . assertEqual ( custom_holder . CUSTOM_HOLDER_SIMPLE_VALUE , True ) <EOL> def test_subclass_configured_data ( self ) : <EOL> self . assertTrue ( '<STR_LIT>' in dir ( settings ) ) <EOL> self . assertEqual ( settings . TESTS_CONFIGURE_METHOD_VALUE2 , False ) <EOL> @ override_settings ( TESTS_SIMPLE_VALUE = False ) <EOL> def test_override_settings_once ( self ) : <EOL> self . assertEqual ( settings . TESTS_SIMPLE_VALUE , False ) <EOL> @ override_settings ( TESTS_SIMPLE_VALUE = False ) <EOL> def test_override_settings_twice ( self ) : <EOL> self . assertEqual ( settings . TESTS_SIMPLE_VALUE , False ) <EOL> class PrefixConfTests ( TestCase ) : <EOL> def test_prefix ( self ) : <EOL> self . assertEqual ( PrefixConf . _meta . prefix , '<STR_LIT>' ) <EOL> def test_simple ( self ) : <EOL> self . assertTrue ( hasattr ( settings , '<STR_LIT>' ) ) <EOL> self . assertEqual ( settings . PREFIX_SIMPLE_VALUE , True ) <EOL> def test_configured ( self ) : <EOL> self . assertTrue ( hasattr ( settings , '<STR_LIT>' ) ) <EOL> self . assertEqual ( settings . PREFIX_CONFIGURED_VALUE , '<STR_LIT>' ) <EOL> def test_configure_method ( self ) : <EOL> self . assertTrue ( hasattr ( settings , '<STR_LIT>' ) ) <EOL> self . assertEqual ( settings . PREFIX_CONFIGURE_METHOD_VALUE , True ) <EOL> class YetAnotherPrefixConfTests ( TestCase ) : <EOL> def test_prefix ( self ) : <EOL> self . assertEqual ( YetAnotherPrefixConf . _meta . prefix , <EOL> '<STR_LIT>' ) <EOL> def test_simple ( self ) : <EOL> self . assertTrue ( hasattr ( settings , <EOL> '<STR_LIT>' ) ) <EOL> self . assertEqual ( settings . YETANOTHER_PREFIX_SIMPLE_VALUE , False ) <EOL> def test_configured ( self ) : <EOL> self . assertTrue ( hasattr ( settings , <EOL> '<STR_LIT>' ) ) <EOL> self . assertEqual ( settings . YETANOTHER_PREFIX_CONFIGURED_VALUE , <EOL> '<STR_LIT>' ) <EOL> def test_configure_method ( self ) : <EOL> self . assertTrue ( hasattr ( settings , <EOL> '<STR_LIT>' ) ) <EOL> self . assertEqual ( settings . YETANOTHER_PREFIX_CONFIGURE_METHOD_VALUE , <EOL> True ) <EOL> class SeparateConfTests ( TestCase ) : <EOL> def test_prefix ( self ) : <EOL> self . assertEqual ( SeparateConf . _meta . prefix , '<STR_LIT>' ) <EOL> def test_simple ( self ) : <EOL> self . assertTrue ( hasattr ( settings , '<STR_LIT>' ) ) <EOL> self . assertEqual ( settings . PREFIX_SEPARATE_VALUE , True ) <EOL> class RequiredSettingsTests ( TestCase ) : <EOL> def create_invalid_conf ( self ) : <EOL> class RequirementConf ( AppConf ) : <EOL> class Meta : <EOL> required = [ '<STR_LIT>' ] <EOL> def test_value_is_defined ( self ) : <EOL> class RequirementConf ( AppConf ) : <EOL> class Meta : <EOL> holder = '<STR_LIT>' <EOL> prefix = '<STR_LIT>' <EOL> required = [ '<STR_LIT>' ] <EOL> def test_default_is_defined ( self ) : <EOL> class RequirementConf ( AppConf ) : <EOL> SIMPLE_VALUE = True <EOL> class Meta : <EOL> required = [ '<STR_LIT>' ] <EOL> def test_missing ( self ) : <EOL> self . assertRaises ( ImproperlyConfigured , self . create_invalid_conf ) </s>
