def test_get_switches_error_if_malformed_in_list(self):
     with mock.patch('settings_composer.environment.os') as _os:
         _os.environ = {
             constants.SWITCHES_VARIABLE_NAME: 'good:switch,bad_switch'
         }
         with self.assertRaises(ImproperlyConfigured):
             environment.get_switches()
 def test_get_switches_single_switch(self):
     with mock.patch('settings_composer.environment.os') as _os:
         _os.environ = {
             constants.SWITCHES_VARIABLE_NAME: 'good:switch'
         }
         self.assertEqual(
             environment.get_switches(),
             {'good': 'switch'}
         )
 def test_get_switches_multiple_switches_and_blankspace(self):
     with mock.patch('settings_composer.environment.os') as _os:
         _os.environ = {
             constants.SWITCHES_VARIABLE_NAME: 'good : switch, another:switch, switch_number: three  '
         }
         self.assertEqual(
             environment.get_switches(),
             {
                 'good': 'switch',
                 'another': 'switch',
                 'switch_number': 'three'
             }
         )
 def test_get_switches_blank_if_empty(self):
     with mock.patch('settings_composer.environment.os') as _os:
         _os.environ = {
             constants.SWITCHES_VARIABLE_NAME: '   '
         }
         self.assertEqual(environment.get_switches(), {})
 def test_get_switches_blank_if_none(self):
     with mock.patch('settings_composer.environment.os') as _os:
         _os.environ = {}
         self.assertEqual(environment.get_switches(), {})