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')
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')
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)