From f733133c835193a884edcf34e5daff6365745d21 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Thu, 23 Jul 2015 17:04:20 +0200 Subject: Options/Types: Fix database OPTIONS parsing This is mostly from 257eb0c17 and 16d3e04cb to allow for setting arbitrary database options since some settings require nested dictionaries, etc. This got lost during merge from maint into master because of the completely different Options parsing. --- testsuite/Testsrc/Testlib/TestOptions/TestTypes.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'testsuite/Testsrc/Testlib/TestOptions/TestTypes.py') diff --git a/testsuite/Testsrc/Testlib/TestOptions/TestTypes.py b/testsuite/Testsrc/Testlib/TestOptions/TestTypes.py index 404d67fdc..0b67db38a 100644 --- a/testsuite/Testsrc/Testlib/TestOptions/TestTypes.py +++ b/testsuite/Testsrc/Testlib/TestOptions/TestTypes.py @@ -46,21 +46,23 @@ class TestOptionTypes(Bcfg2TestCase): self.assertItemsEqual(self._test_options(["--test", "one:two three"]), ["one", "two three"]) - def test_comma_dict(self): - """parse comma-dict values.""" - self.options = [Option("--test", type=Types.comma_dict)] + def test_literal_dict(self): + """parse literal-dict values.""" + self.options = [Option("--test", type=Types.literal_dict)] expected = { "one": True, "two": 2, "three": "three", - "four": False} + "four": False, + "five": { + "a": 1, + "b": 2 + }} self.assertDictEqual( self._test_options(["--test", - "one=yes, two=2 , three=three,four=no"]), - expected) - - self.assertDictEqual( - self._test_options(["--test", "one,two=2,three=three,four=off"]), + '''{ "one": True, "two": 2, + "three": "three", "four": False, + "five": { "a": 1, "b": 2 }}''']), expected) def test_anchored_regex_list(self): -- cgit v1.2.3-1-g7c22