summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2012-11-23 15:12:12 +0000
committerMark McLoughlin <markmc@redhat.com>2012-11-23 15:14:53 +0000
commit5e9503bf9934f1ccc15985ee29eb76dc04ebad6a (patch)
tree708b966951a8b09c2a5761529da26e1b3f25643f /tests
parentb4c0767e5529eb5d58aed90643354dbee83efefe (diff)
downloadoslo-5e9503bf9934f1ccc15985ee29eb76dc04ebad6a.tar.gz
oslo-5e9503bf9934f1ccc15985ee29eb76dc04ebad6a.tar.xz
oslo-5e9503bf9934f1ccc15985ee29eb76dc04ebad6a.zip
Hide the GroupAttr conf and group attributes
There's no reason why an option group shouldn't have options called 'group' or 'conf'. Add a test case which would have failed because the 'conf' attribute would have been a ConfigOpts instance and fix it by making those attributes private. Change-Id: Ic3e41a546c0d1b7b6aae04e1dbac2933ac661f57
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_cfg.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/unit/test_cfg.py b/tests/unit/test_cfg.py
index 384a57a..4bfc37a 100644
--- a/tests/unit/test_cfg.py
+++ b/tests/unit/test_cfg.py
@@ -735,6 +735,18 @@ class OptGroupsTestCase(BaseTestCase):
self.assertTrue(hasattr(self.conf.blaa, 'foo'))
self.assertEquals(self.conf.blaa.foo, 'bar')
+ def test_arg_group_with_conf_and_group_opts(self):
+ self.conf.register_cli_opt(StrOpt('conf'), group='blaa')
+ self.conf.register_cli_opt(StrOpt('group'), group='blaa')
+
+ self.conf(['--blaa-conf', 'foo', '--blaa-group', 'bar'])
+
+ self.assertTrue(hasattr(self.conf, 'blaa'))
+ self.assertTrue(hasattr(self.conf.blaa, 'conf'))
+ self.assertEquals(self.conf.blaa.conf, 'foo')
+ self.assertTrue(hasattr(self.conf.blaa, 'group'))
+ self.assertEquals(self.conf.blaa.group, 'bar')
+
def test_arg_group_in_config_file(self):
self.conf.register_group(OptGroup('blaa'))
self.conf.register_opt(StrOpt('foo'), group='blaa')