From d167f4556ebb8e4973fa3b785e75af7e64c04d08 Mon Sep 17 00:00:00 2001 From: "Roman v. Gemmeren" Date: Tue, 31 Mar 2020 13:10:46 +0200 Subject: [PATCH] add test for valid json-output --- tests/test_cli.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_cli.py b/tests/test_cli.py index 517bc62..3d86108 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -25,6 +25,7 @@ import pty import shutil import sys import unittest +import json from tests.common import build_temp_workspace @@ -517,3 +518,11 @@ class CommandLineTestCase(unittest.TestCase): '\n' % path) self.assertEqual( (ctx.returncode, ctx.stdout, ctx.stderr), (1, expected_out, '')) + + def test_json_output(self): + path = os.path.join(self.wd, 'a.yaml') + + with RunContext(self) as ctx: + cli.run(('-f', 'json', path)) + print (ctx.stdout) + self.assertTrue(json.loads(ctx.stdout))