summaryrefslogtreecommitdiff
path: root/tests/functional/cli/test_cli.py
diff options
context:
space:
mode:
authorWaldek Maleska <w.maleska@gmail.com>2022-07-04 09:31:56 +0100
committerJohn Villalovos <john@sodarock.com>2022-07-28 07:09:08 -0700
commit005ba93074d391f818c39e46390723a0d0d16098 (patch)
tree0c64c57bf7871856b9ad6f5545a2e964c462ccf3 /tests/functional/cli/test_cli.py
parent1cf59323194b2352bd1c1313415cd09bbdddcc5f (diff)
downloadgitlab-005ba93074d391f818c39e46390723a0d0d16098.tar.gz
feat(cli): add a custom help formatter
Add a custom argparse help formatter that overrides the output format to list items vertically. The formatter is derived from argparse.HelpFormatter with minimal changes. Co-authored-by: John Villalovos <john@sodarock.com> Co-authored-by: Nejc Habjan <nejc.habjan@siemens.com>
Diffstat (limited to 'tests/functional/cli/test_cli.py')
-rw-r--r--tests/functional/cli/test_cli.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/functional/cli/test_cli.py b/tests/functional/cli/test_cli.py
index f07fa2a..6edea7f 100644
--- a/tests/functional/cli/test_cli.py
+++ b/tests/functional/cli/test_cli.py
@@ -34,6 +34,18 @@ def test_config_error_with_help_prints_help(script_runner):
assert ret.returncode == 0
+def test_global_help_prints_resources_vertically(script_runner):
+ ret = script_runner.run("gitlab", "--help")
+ assert """resource:\n application\n application-appearance\n""" in ret.stdout
+ assert ret.returncode == 0
+
+
+def test_resource_help_prints_actions_vertically(script_runner):
+ ret = script_runner.run("gitlab", "project", "--help")
+ assert """action:\n list\n get""" in ret.stdout
+ assert ret.returncode == 0
+
+
@pytest.mark.script_launch_mode("inprocess")
@responses.activate
def test_defaults_to_gitlab_com(script_runner, resp_get_project, monkeypatch):