<s> from django import conf <EOL> from django . test import TestCase <EOL> from django_dynamic_fixture import global_settings <EOL> from django_dynamic_fixture . fixture_algorithms . sequential_fixture import SequentialDataFixture , StaticSequentialDataFixture <EOL> from django_dynamic_fixture . fixture_algorithms . random_fixture import RandomDataFixture <EOL> from six . moves import reload_module <EOL> class AbstractGlobalSettingsTestCase ( TestCase ) : <EOL> def tearDown ( self ) : <EOL> if hasattr ( conf . settings , '<STR_LIT>' ) : del conf . settings . DDF_DEFAULT_DATA_FIXTURE <EOL> if hasattr ( conf . settings , '<STR_LIT>' ) : del conf . settings . DDF_FILL_NULLABLE_FIELDS <EOL> if hasattr ( conf . settings , '<STR_LIT>' ) : del conf . settings . DDF_IGNORE_FIELDS <EOL> if hasattr ( conf . settings , '<STR_LIT>' ) : del conf . settings . DDF_NUMBER_OF_LAPS <EOL> if hasattr ( conf . settings , '<STR_LIT>' ) : del conf . settings . DDF_VALIDATE_MODELS <EOL> reload_module ( conf ) <EOL> class CustomDataFixture ( object ) : pass <EOL> class DDF_DEFAULT_DATA_FIXTURE_TestCase ( AbstractGlobalSettingsTestCase ) : <EOL> def test_not_configured_must_load_default_value ( self ) : <EOL> reload_module ( global_settings ) <EOL> self . assertEquals ( SequentialDataFixture , type ( global_settings . DDF_DEFAULT_DATA_FIXTURE ) ) <EOL> def test_may_be_an_internal_data_fixture_nick_name ( self ) : <EOL> conf . settings . DDF_DEFAULT_DATA_FIXTURE = '<STR_LIT>' <EOL> reload_module ( global_settings ) <EOL> self . assertEquals ( SequentialDataFixture , type ( global_settings . DDF_DEFAULT_DATA_FIXTURE ) ) <EOL> conf . settings . DDF_DEFAULT_DATA_FIXTURE = '<STR_LIT>' <EOL> reload_module ( global_settings ) <EOL> self . assertEquals ( RandomDataFixture , type ( global_settings . DDF_DEFAULT_DATA_FIXTURE ) ) <EOL> conf . settings . DDF_DEFAULT_DATA_FIXTURE = '<STR_LIT>' <EOL> reload_module ( global_settings ) <EOL> self . assertEquals ( StaticSequentialDataFixture , type ( global_settings . DDF_DEFAULT_DATA_FIXTURE ) ) <EOL> def test_may_be_a_path_to_a_custom_data_fixture ( self ) : <EOL> conf . settings . DDF_DEFAULT_DATA_FIXTURE = '<STR_LIT>' <EOL> reload_module ( global_settings ) <EOL> self . assertEquals ( CustomDataFixture , type ( global_settings . DDF_DEFAULT_DATA_FIXTURE ) ) <EOL> def test_if_path_can_not_be_found_it_will_raise_an_exception ( self ) : <EOL> conf . settings . DDF_DEFAULT_DATA_FIXTURE = '<STR_LIT>' <EOL> self . assertRaises ( Exception , reload_module , global_settings ) <EOL> class DDF_FILL_NULLABLE_FIELDS_TestCase ( AbstractGlobalSettingsTestCase ) : <EOL> def test_not_configured_must_load_default_value ( self ) : <EOL> reload_module ( global_settings ) <EOL> self . assertEquals ( True , global_settings . DDF_FILL_NULLABLE_FIELDS ) <EOL> def test_must_be_a_boolean ( self ) : <EOL> conf . settings . DDF_FILL_NULLABLE_FIELDS = False <EOL> reload_module ( global_settings ) <EOL> self . assertEquals ( False , global_settings . DDF_FILL_NULLABLE_FIELDS ) <EOL> def test_must_raise_an_exception_if_it_is_not_a_boolean ( self ) : <EOL> conf . settings . DDF_FILL_NULLABLE_FIELDS = '<STR_LIT:x>' <EOL> self . assertRaises ( Exception , reload_module , global_settings ) <EOL> class DDF_IGNORE_FIELDS_TestCase ( AbstractGlobalSettingsTestCase ) : <EOL> def test_not_configured_must_load_default_value ( self ) : <EOL> reload_module ( global_settings ) <EOL> self . assertEquals ( [ ] , global_settings . DDF_IGNORE_FIELDS ) <EOL> def test_must_be_a_list_of_strings ( self ) : <EOL> conf . settings . DDF_IGNORE_FIELDS = [ '<STR_LIT:x>' ] <EOL> reload_module ( global_settings ) <EOL> self . assertEquals ( [ '<STR_LIT:x>' ] , global_settings . DDF_IGNORE_FIELDS ) <EOL> def test_must_raise_an_exception_if_it_is_not_an_list_of_strings ( self ) : <EOL> conf . settings . DDF_IGNORE_FIELDS = None <EOL> self . assertRaises ( Exception , reload_module , global_settings ) <EOL> class DDF_NUMBER_OF_LAPS_TestCase ( AbstractGlobalSettingsTestCase ) : <EOL> def test_not_configured_must_load_default_value ( self ) : <EOL> reload_module ( global_settings ) <EOL> self . assertEquals ( <NUM_LIT:1> , global_settings . DDF_NUMBER_OF_LAPS ) <EOL> def test_must_be_an_integer ( self ) : <EOL> conf . settings . DDF_NUMBER_OF_LAPS = <NUM_LIT:2> <EOL> reload_module ( global_settings ) <EOL> self . assertEquals ( <NUM_LIT:2> , global_settings . DDF_NUMBER_OF_LAPS ) <EOL> def test_must_raise_an_exception_if_it_is_not_an_integer ( self ) : <EOL> conf . settings . DDF_NUMBER_OF_LAPS = None <EOL> self . assertRaises ( Exception , reload_module , global_settings ) <EOL> class DDF_VALIDATE_MODELS_TestCase ( AbstractGlobalSettingsTestCase ) : <EOL> def test_not_configured_must_load_default_value ( self ) : <EOL> reload_module ( global_settings ) <EOL> self . assertEquals ( False , global_settings . DDF_VALIDATE_MODELS ) <EOL> def test_must_be_a_boolean ( self ) : <EOL> conf . settings . DDF_VALIDATE_MODELS = False <EOL> reload_module ( global_settings ) <EOL> self . assertEquals ( False , global_settings . DDF_VALIDATE_MODELS ) <EOL> def test_must_raise_an_exception_if_it_is_not_a_boolean ( self ) : <EOL> conf . settings . DDF_VALIDATE_MODELS = '<STR_LIT:x>' <EOL> self . assertRaises ( Exception , reload_module , global_settings ) <EOL> class DDF_USE_LIBRARY_TestCase ( AbstractGlobalSettingsTestCase ) : <EOL> def test_not_configured_must_load_default_value ( self ) : <EOL> reload_module ( global_settings ) <EOL> self . assertEquals ( False , global_settings . DDF_USE_LIBRARY ) <EOL> def test_must_be_a_boolean ( self ) : <EOL> conf . settings . DDF_USE_LIBRARY = False <EOL> reload_module ( global_settings ) <EOL> self . assertEquals ( False , global_settings . DDF_USE_LIBRARY ) <EOL> def test_must_raise_an_exception_if_it_is_not_a_boolean ( self ) : <EOL> conf . settings . DDF_USE_LIBRARY = '<STR_LIT:x>' <EOL> self . assertRaises ( Exception , reload_module , global_settings ) </s>
