Esempio n. 1
0
 def test_get_setting_from_env(self):
     """Should always return the value from the env if it exists."""
     self.assertEqual(get_env_or_setting('TESTING_SETTINGS'), None)
     with patch('basket.base.settings',
                type('X', (object,), {'TESTING_SETTINGS': 'DUDE'})):
         self.assertEqual(get_env_or_setting('TESTING_SETTINGS'), 'DUDE')
         with patch.dict('os.environ', {'TESTING_SETTINGS': 'WALTER'}):
             self.assertEqual(get_env_or_setting('TESTING_SETTINGS'),
                              'WALTER')
Esempio n. 2
0
 def test_get_setting_from_env(self):
     """Should always return the value from the env if it exists."""
     self.assertEqual(get_env_or_setting('TESTING_SETTINGS'), None)
     with patch('basket.base.settings',
                type('X', (object, ), {'TESTING_SETTINGS': 'DUDE'})):
         self.assertEqual(get_env_or_setting('TESTING_SETTINGS'), 'DUDE')
         with patch.dict('os.environ', {'TESTING_SETTINGS': 'WALTER'}):
             self.assertEqual(get_env_or_setting('TESTING_SETTINGS'),
                              'WALTER')
Esempio n. 3
0
 def test_gets_setting(self):
     """Should return the setting if it exists."""
     self.assertEqual(get_env_or_setting('TESTING_SETTINGS'), True)
     self.assertEqual(get_env_or_setting('DOES_NOT_EXIST'), None)
Esempio n. 4
0
 def test_gets_setting(self):
     """Should return the setting if it exists."""
     self.assertEqual(get_env_or_setting('TESTING_SETTINGS'), True)
     self.assertEqual(get_env_or_setting('DOES_NOT_EXIST'), None)