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