aboutsummaryrefslogtreecommitdiffstats
path: root/tests/sos_tests.py
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/sos_tests.py
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/sos_tests.py')
-rw-r--r--tests/sos_tests.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/sos_tests.py b/tests/sos_tests.py
index 9fc4ceef..84173cf8 100644
--- a/tests/sos_tests.py
+++ b/tests/sos_tests.py
@@ -840,3 +840,30 @@ class StageOneReportExceptionTest(BaseSoSReportTest):
@skipIf(lambda x: x.archive_still_expected, "Output expected in test")
def test_no_archive_generated(self):
self.assertTrue(self.archive is None)
+
+
+class StageOneOutputTest(BaseSoSTest):
+ """This test class should be used for tests that are only checking or
+ validating output from a specific command or option, such as --help or
+ --list.
+
+ :avocado: disable
+ :avocado: tags=stageone
+ """
+
+ sos_cmd = ''
+
+ def _generate_sos_command(self):
+ return "%s %s" % (SOS_BIN, self.sos_cmd)
+
+ @skipIf(lambda x: x._exception_expected, "Non-zero exit code expected")
+ def test_help_output_successful(self):
+ self.assertTrue(self.cmd_output.exit_status == 0)
+ assert self.cmd_output.stdout, "No stdout output generated"
+ assert not self.cmd_output.stderr, "stderr received, but not expected: %s" % self.cmd_output.stderr
+
+ @skipIf(lambda x: not x._exception_expected, "Not anticipating stderr output")
+ def test_help_error_reported(self):
+ self.assertTrue(self.cmd_output.exit_status != 0)
+ assert not self.cmd_output.stdout, "stdout received, but not expected: %s" % self.cmd_output.stdout
+ assert self.cmd_output.stderr, "No stderr output generated"