@@ 108-124 (lines=17) @@ | ||
105 | x = anyconfig.api.load(output) |
|
106 | self.assertEqual(x, d['a']['b']) |
|
107 | ||
108 | def test_32_w_set_option(self): |
|
109 | d = dict(name="a", a=dict(b=dict(c=[1, 2], d="C"))) |
|
110 | ||
111 | infile = os.path.join(self.workdir, "a.json") |
|
112 | output = os.path.join(self.workdir, "b.json") |
|
113 | ||
114 | anyconfig.api.dump(d, infile) |
|
115 | self.assertTrue(os.path.exists(infile)) |
|
116 | ||
117 | TT.main(["dummy", "-q", "-o", output, "--set", "a.b.d=E", infile]) |
|
118 | self.assertTrue(os.path.exists(output)) |
|
119 | ||
120 | ref = d.copy() |
|
121 | ref['a']['b']['d'] = 'E' |
|
122 | ||
123 | x = anyconfig.api.load(output) |
|
124 | self.assertEqual(x, ref) |
|
125 | ||
126 | def test_40_ignore_missing(self): |
|
127 | infile = os.path.join(os.curdir, "conf_file_should_not_exist.json") |
|
@@ 93-106 (lines=14) @@ | ||
90 | def test_20_wo_input_type(self): |
|
91 | self._assert_run_and_exit("a.conf") |
|
92 | ||
93 | def test_30_w_get_option(self): |
|
94 | d = dict(name="a", a=dict(b=dict(c=[1, 2], d="C"))) |
|
95 | ||
96 | infile = os.path.join(self.workdir, "a.json") |
|
97 | output = os.path.join(self.workdir, "b.json") |
|
98 | ||
99 | anyconfig.api.dump(d, infile) |
|
100 | self.assertTrue(os.path.exists(infile)) |
|
101 | ||
102 | TT.main(["dummy", "--silent", "-o", output, "--get", "a.b", infile]) |
|
103 | self.assertTrue(os.path.exists(output)) |
|
104 | ||
105 | x = anyconfig.api.load(output) |
|
106 | self.assertEqual(x, d['a']['b']) |
|
107 | ||
108 | def test_32_w_set_option(self): |
|
109 | d = dict(name="a", a=dict(b=dict(c=[1, 2], d="C"))) |