diff options
author | Davanum Srinivas <dims@linux.vnet.ibm.com> | 2012-12-26 22:50:35 -0500 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-01-02 19:12:44 +0000 |
commit | 525ac47bb934621057904725376108f56f6c57fe (patch) | |
tree | 9a1ec3260e559e7bd09d5bad91f87c7b572f033e /tests | |
parent | ffeb0855085617095f19296770a1223cb5641d1c (diff) | |
download | oslo-525ac47bb934621057904725376108f56f6c57fe.tar.gz oslo-525ac47bb934621057904725376108f56f6c57fe.tar.xz oslo-525ac47bb934621057904725376108f56f6c57fe.zip |
Support lookup of value using "group.key"
Let us check if the opt_name has a '.', if it does then split it
into a group/key and try lookup using that combination. Since
LazyPluggable uses "CONF[self.__pivot]" if we just add this
capability to cfg, we get "LazyPluggable doesn't support
option groups" for free.
Fixes LP #1093043
Change-Id: I9cedcf22014038e9fe4ed5e66ca5427aa99b5091
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/test_cfg.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/unit/test_cfg.py b/tests/unit/test_cfg.py index ff24c0c..2da085a 100644 --- a/tests/unit/test_cfg.py +++ b/tests/unit/test_cfg.py @@ -1120,6 +1120,12 @@ class OverridesTestCase(BaseTestCase): self.conf.clear_override('foo', group='blaa') self.assertEquals(self.conf.blaa.foo, None) + def test_group_get_group_option(self): + self.conf.register_group(OptGroup('blaa')) + self.conf.register_opt(StrOpt('foo', default='foo2'), group='blaa') + self.conf([]) + self.assertEquals(self.conf['blaa.foo'], 'foo2') + def test_cli_bool_default(self): self.conf.register_cli_opt(BoolOpt('foo')) self.conf.set_default('foo', True) |