|
@@ 151-160 (lines=10) @@
|
| 148 |
|
def test_52_wo_schema(self): |
| 149 |
|
self.run_and_check_exit_code(["--validate", CNF_0_PATH], 1) |
| 150 |
|
|
| 151 |
|
def test_54_gen_schema_and_validate_with_it(self): |
| 152 |
|
cnf = dict(name="a", a=1, b=dict(b=[1, 2], c="C")) |
| 153 |
|
infile = os.path.join(self.workdir, "cnf.json") |
| 154 |
|
output = os.path.join(self.workdir, "out.yaml") |
| 155 |
|
anyconfig.api.dump(cnf, infile) |
| 156 |
|
|
| 157 |
|
self.run_and_check_exit_code(["--gen-schema", "-o", output, infile], 0) |
| 158 |
|
self.assertTrue(os.path.exists(output)) |
| 159 |
|
self.run_and_check_exit_code(["--schema", output, "--validate", |
| 160 |
|
infile], 0) |
| 161 |
|
|
| 162 |
|
def test_60_w_arg_option(self): |
| 163 |
|
a = dict(name="a", a=1, b=dict(b=[1, 2], c="C"), d=[1, 2]) |
|
@@ 265-273 (lines=9) @@
|
| 262 |
|
|
| 263 |
|
self.run_and_check_exit_code(["--itype", "json", infile]) |
| 264 |
|
|
| 265 |
|
def test_20_no_out_dumper(self): |
| 266 |
|
a = dict(name="a", a=1, b=dict(b=[1, 2], c="C"), d=[1, 2]) |
| 267 |
|
infile = os.path.join(self.workdir, "a.json") |
| 268 |
|
anyconfig.api.dump(a, infile) |
| 269 |
|
|
| 270 |
|
exited = False |
| 271 |
|
outfile = os.path.join(self.workdir, "out.conf") |
| 272 |
|
_run("-o", outfile, infile) |
| 273 |
|
self.assertFalse(exited) |
| 274 |
|
|
| 275 |
|
def test_30_no_itype_and_otype(self): |
| 276 |
|
exited = False |