summaryrefslogtreecommitdiffstats
path: root/testsuite/Testsrc/Testlib/TestOptions/TestComponents.py
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/Testsrc/Testlib/TestOptions/TestComponents.py')
-rw-r--r--testsuite/Testsrc/Testlib/TestOptions/TestComponents.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/testsuite/Testsrc/Testlib/TestOptions/TestComponents.py b/testsuite/Testsrc/Testlib/TestOptions/TestComponents.py
index 61b87de2a..b1ed4cb2b 100644
--- a/testsuite/Testsrc/Testlib/TestOptions/TestComponents.py
+++ b/testsuite/Testsrc/Testlib/TestOptions/TestComponents.py
@@ -182,7 +182,8 @@ class TestImportComponentOptions(OptionTestCase):
"""test cases for component loading."""
def setUp(self):
- self.options = [Option("--cls", action=ImportComponentAction),
+ self.options = [Option("--cls", cf=("config", "cls"),
+ action=ImportComponentAction),
Option("--module", action=ImportModuleAction)]
self.result = argparse.Namespace()
@@ -227,3 +228,10 @@ class TestImportComponentOptions(OptionTestCase):
self.assertRaises(SystemExit,
self.parser.parse,
["-C", config_file, "--cls", "Bcfg2.No.Such.Thing"])
+
+ @make_config({"config": {"test": "foo", "cls": "Two"}})
+ def test_default_from_config_for_component_options(self, config_file):
+ """use default value from config file for options added by dynamic loaded component."""
+ self.parser.parse(["-C", config_file])
+ self.assertEqual(self.result.cls, Two.Two)
+ self.assertEqual(self.result.test, "foo")