def test_get_settings_module_name_error_if_empty(self): with mock.patch('settings_composer.environment.os') as _os: _os.environ = { constants.SETTINGS_MODULE_VARIABLE_NAME: '' } with self.assertRaises(ImproperlyConfigured): environment.get_settings_module_name()
def test_get_settings_module_name(self): with mock.patch('settings_composer.environment.os') as _os: _os.environ = { constants.SETTINGS_MODULE_VARIABLE_NAME: 'my.settings.module' } self.assertEqual( environment.get_settings_module_name(), 'my.settings.module' )
def test_get_settings_module_name_error_if_none(self): with mock.patch('settings_composer.environment.os') as _os: _os.environ = {} with self.assertRaises(ImproperlyConfigured): environment.get_settings_module_name()