summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-09-02 14:16:47 -0400
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-09-02 14:16:47 -0400
commitf072d2df0e2fc3d1932af3726e7c04c99d39a56e (patch)
treee214798cffec1cba8024583aabdc030c7a8ae850
parenteebba58e1ff348e4dfafc1c7e7816ca7526a1083 (diff)
downloadbuildstream-f072d2df0e2fc3d1932af3726e7c04c99d39a56e.tar.gz
tests/frontend/help.py: Adding test case for --help of all commands
-rw-r--r--tests/frontend/help.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/frontend/help.py b/tests/frontend/help.py
new file mode 100644
index 000000000..a38125f77
--- /dev/null
+++ b/tests/frontend/help.py
@@ -0,0 +1,43 @@
+from click.testing import CliRunner
+import pytest
+
+# Import the main cli entrypoint
+from buildstream._frontend.main import cli
+
+
+def assert_help(cli_output):
+ expected_start = "Usage: "
+ if not cli_output.startswith(expected_start):
+ raise AssertionError("Help output expected to begin with '{}',"
+ .format(expected_start) +
+ " output was: {}"
+ .format(cli_output))
+
+
+@pytest.fixture(scope="module")
+def runner():
+ return CliRunner()
+
+
+def test_help_main(runner):
+ result = runner.invoke(cli, ['--help'])
+ assert result.exit_code == 0
+ assert_help(result.output)
+
+
+@pytest.mark.parametrize("command", [
+ ('build'),
+ ('checkout'),
+ ('fetch'),
+ ('pull'),
+ ('push'),
+ ('shell'),
+ ('show'),
+ ('source-bundle'),
+ ('track'),
+ ('workspace')
+])
+def test_help(runner, command):
+ result = runner.invoke(cli, [command, '--help'])
+ assert result.exit_code == 0
+ assert_help(result.output)