def setUp(self): os.environ["WEB_DOMAIN"] = "localhost:5050" os.environ["WORKER_PORT"] = "2020" os.environ["CONFIG_MODE"] = "TESTING" with open("test_data/config_a.json", 'r') as config_a: self.config_a = envcfg(json.load(config_a))
def test_unset_env(self): del os.environ["CONFIG_MODE"] with self.assertRaises(KeyError): with open("test_data/config_a.json", 'r') as config_a: self.config_a = envcfg(json.load(config_a))
def test_unsupported_type(self): # sets are unsupported bad_type = set([1, 5, "foo", 5.5]) with self.assertRaises(TypeError): config = envcfg(bad_type)