aboutsummaryrefslogtreecommitdiffstats
path: root/tests/report_tests
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2021-06-03 23:23:56 -0400
committerJake Hunsaker <jhunsake@redhat.com>2021-06-22 13:40:57 -0400
commita85ec702633911ad52bb0390872423c7f9c313ff (patch)
treea25ae235eb7a6101c85ccc9c22f3ecf9fddd26e8 /tests/report_tests
parent6cee29207b3b797d6dd6f851b27ebf7c719729fd (diff)
downloadsos-a85ec702633911ad52bb0390872423c7f9c313ff.tar.gz
[tests] Add tests to ensure help output
In the past, there have been otherwise trivial typos and the like that have caused `--help` output to be unreliable. In the case of "help options" such as `--list-plugins` this also includes potentially unavailable detailed information about whatever is being listed. These tests are sanity checks to ensure that changes aren't regressing this behavior and that the informational output options, and `--help` directly, continue to provide the right output. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Diffstat (limited to 'tests/report_tests')
-rw-r--r--tests/report_tests/help_output_tests.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/report_tests/help_output_tests.py b/tests/report_tests/help_output_tests.py
new file mode 100644
index 00000000..f1a4104b
--- /dev/null
+++ b/tests/report_tests/help_output_tests.py
@@ -0,0 +1,51 @@
+# This file is part of the sos project: https://github.com/sosreport/sos
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# version 2 of the GNU General Public License.
+#
+# See the LICENSE file in the source distribution for further information.
+
+import re
+
+from sos_tests import StageOneOutputTest
+
+
+class ReportHelpTest(StageOneOutputTest):
+ """Ensure that --help gives the expected output in the expected format
+
+ :avocado: tags=stageone
+ """
+
+ sos_cmd = 'report --help'
+
+ def test_all_help_sections_present(self):
+ self.assertOutputContains('Global Options:')
+ self.assertOutputContains('Report Options:')
+ self.assertOutputContains('Cleaner/Masking Options:')
+
+
+class ReportListPluginsTest(StageOneOutputTest):
+ """Ensure that --list-plugins gives the expected output
+
+ :avocado: tags=stageone
+ """
+
+ sos_cmd = 'report --list-plugins'
+
+ def test_all_plugin_sections_present(self):
+ self.assertOutputContains('plugins are currently enabled:')
+ self.assertOutputContains('plugins are currently disabled:')
+ self.assertOutputContains('options are available for ALL plugins:')
+ self.assertOutputContains('plugin options are available:')
+ self.assertOutputContains('Profiles:')
+
+ def test_no_missing_plugin_descriptions(self):
+ _out = re.search("The following plugins are currently enabled:(.*?)The following plugins are currently disabled:",
+ self.cmd_output.stdout, re.S).group(1).splitlines()
+ for ln in _out:
+ # Ignore newlines
+ if not ln:
+ continue
+ assert len(ln) > 1, "Plugin '%s' missing description" % ln[0]
+