def test_it_should_raise_exception_when_removing_an_inexistent_config_value(self): config = Config() config.put("some_key", "some_value") try: config.remove("ANOTHER_KEY") except Exception, e: self.assertEqual("invalid configuration key ('another_key')", str(e))
def test_it_should_transform_keys_to_lower_case(self): config = Config() config.put("sOmE_kEy", "original_value") self.assertEqual("original_value", config.get("SoMe_KeY")) config.update("sOMe_kEy", "new_value") self.assertEqual("new_value", config.get("some_KEY")) config.remove("SOME_KEY") self.assertRaises(Exception, config.get, "sOMe_KEY")
def test_it_should_remove_saved_config_values(self): config = Config() config.put("some_key", "some_value") initial = str(config) config.remove("some_key") self.assertNotEqual(initial, str(config))