summaryrefslogtreecommitdiffstats
path: root/tests/test_cmdline
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2013-04-03 10:40:30 +0200
committerMartin Kosek <mkosek@redhat.com>2013-04-03 15:32:03 +0200
commit4a30bf55ac3a067c668058299cbd355ab63e9dd9 (patch)
tree2eeb956f423e280904be94eebf5c20ef5f0e5cda /tests/test_cmdline
parentf770556946091ffaf2e17a0c3b20868d26f1a75e (diff)
downloadfreeipa-4a30bf55ac3a067c668058299cbd355ab63e9dd9.tar.gz
freeipa-4a30bf55ac3a067c668058299cbd355ab63e9dd9.tar.xz
freeipa-4a30bf55ac3a067c668058299cbd355ab63e9dd9.zip
Display full command documentation in online help
ipa <command> -h only showed the summary string, not the full help. Use the full docstring. Add a custom help formatter that disables optparse's reformatting. Test included https://fedorahosted.org/freeipa/ticket/3543
Diffstat (limited to 'tests/test_cmdline')
-rw-r--r--tests/test_cmdline/test_help.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_cmdline/test_help.py b/tests/test_cmdline/test_help.py
index 1ab3ddc49..4cf633683 100644
--- a/tests/test_cmdline/test_help.py
+++ b/tests/test_cmdline/test_help.py
@@ -128,3 +128,14 @@ def test_ambiguous_command_or_topic():
assert h_ctx.stderr == ''
assert h_ctx.stdout != help_ctx.stdout
+
+def test_multiline_description():
+ """Test that all of a multi-line command description appears in output
+ """
+ # This assumes trust_add has multiline doc. Ensure it is so.
+ assert '\n\n' in unicode(api.Command.trust_add.doc).strip()
+
+ with CLITestContext(exception=SystemExit) as help_ctx:
+ return_value = api.Backend.cli.run(['trust-add', '-h'])
+
+ assert unicode(api.Command.trust_add.doc).strip() in help_ctx.stdout