def test_define_then_load_registry(self): """Test loading the registry.""" registry = openstack.common.config.registry.Registry() registry.define(section="logging", name="log_file", datatype=config.String, default="default", description="Test description.") registry.load(StringIO.StringIO(self.test_config)) self.assertEquals("override", registry.get("logging", "log_file"))
def test_load_registry_undefined(self): """Test loading the registry.""" registry = openstack.common.config.registry.Registry() registry.load(StringIO.StringIO(self.test_config)) with self.assertRaises(exceptions.NoSuchConfigOption): registry.get("logging", "blah")
def test_get_nonexistant_option(self): """Try to get a configuration option that doesn't exist.""" registry = openstack.common.config.registry.Registry() with self.assertRaises(exceptions.NoSuchConfigOption): registry.get("section", None)