From df82e3c66aa0b8a529eeb3e5a99e4b21a20a2287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Gmach?= Date: Sat, 28 Nov 2020 10:39:18 +0100 Subject: [PATCH 1/2] Add test for printing help when cli is called with no args modified: tests/test_cmdline.py --- tests/test_cmdline.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index 993a96c..ce95afe 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -82,3 +82,12 @@ def test_handle_value_errors(mocked_TNEF): with pytest.raises(SystemExit): from tnefparse.cmdline import tnefparse tnefparse() + + +def test_help_is_printed(script_runner): + """calling `tnefparse` with no argument prints help text""" + ret = script_runner.run('tnefparse') + help_text = "Extract TNEF file contents. Show this help message if no arguments are given." + assert help_text in ret.stdout + assert "positional arguments" in ret.stdout + assert "optional argument" in ret.stdout From e1cba1c9d723afea91dc62437b8a26b83815ff5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Gmach?= Date: Sat, 28 Nov 2020 13:44:07 +0100 Subject: [PATCH 2/2] Add test for the overview cli option modified: tests/test_cmdline.py --- tests/test_cmdline.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index ce95afe..492bed6 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -91,3 +91,11 @@ def test_help_is_printed(script_runner): assert help_text in ret.stdout assert "positional arguments" in ret.stdout assert "optional argument" in ret.stdout + + +def test_print_overview(script_runner): + ret = script_runner.run('tnefparse', '-o', 'tests/examples/one-file.tnef') + assert "Overview of tests/examples/one-file.tnef" in ret.stdout + assert "Attachments" in ret.stdout + assert "Objects" in ret.stdout + assert "Properties" in ret.stdout