summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander.sulfrian@fu-berlin.de>2015-07-23 17:04:20 +0200
committerAlexander Sulfrian <alexander.sulfrian@fu-berlin.de>2015-07-23 17:26:13 +0200
commitf733133c835193a884edcf34e5daff6365745d21 (patch)
treec43aa445f574bb1e15843b00388914f5f7c0b9b7 /testsuite
parentc7e67299381df961ff8274e9b53827c2bddbb47b (diff)
downloadbcfg2-f733133c835193a884edcf34e5daff6365745d21.tar.gz
bcfg2-f733133c835193a884edcf34e5daff6365745d21.tar.bz2
bcfg2-f733133c835193a884edcf34e5daff6365745d21.zip
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.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/Testsrc/Testlib/TestOptions/TestTypes.py20
1 files changed, 11 insertions, 9 deletions
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):