summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Reznik <mreznik@redhat.com>2017-12-15 14:49:40 +0100
committerChristian Heimes <cheimes@redhat.com>2017-12-19 14:03:24 +0100
commit23d729e0de6c0bc7447327b434b2458ea85a529d (patch)
tree39f16e9c54b7358da7042019074839adeb0d9521
parentb567f3afea99277d5545b39abc5e6dcd45d91683 (diff)
downloadfreeipa-23d729e0de6c0bc7447327b434b2458ea85a529d.tar.gz
freeipa-23d729e0de6c0bc7447327b434b2458ea85a529d.tar.xz
freeipa-23d729e0de6c0bc7447327b434b2458ea85a529d.zip
test_help: test "help" command without cache
This test case addresses upsteam ticket #6999, where "ipa help" does not work if called when no schema is cached. https://pagure.io/freeipa/issue/7325 Reviewed-By: Christian Heimes <cheimes@redhat.com>
-rw-r--r--ipatests/test_cmdline/test_help.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/ipatests/test_cmdline/test_help.py b/ipatests/test_cmdline/test_help.py
index 2656a8df4..67e44426f 100644
--- a/ipatests/test_cmdline/test_help.py
+++ b/ipatests/test_cmdline/test_help.py
@@ -18,6 +18,9 @@
#
import sys
+import os
+import shutil
+import errno
import six
from six import StringIO
@@ -73,6 +76,27 @@ def test_ipa_help():
assert ctx.stderr == ''
+def test_ipa_help_without_cache():
+ """Test `ipa help` without schema cache"""
+ cache_dir = os.path.expanduser('~/.cache/ipa/schema/')
+ backup_dir = os.path.expanduser('~/.cache/ipa/schema.bak/')
+ shutil.rmtree(backup_dir, ignore_errors=True)
+ if os.path.isdir(cache_dir):
+ os.rename(cache_dir, backup_dir)
+ try:
+ with CLITestContext() as ctx:
+ return_value = api.Backend.cli.run(['help'])
+ assert return_value == 0
+ assert ctx.stderr == ''
+ finally:
+ shutil.rmtree(cache_dir, ignore_errors=True)
+ try:
+ os.rename(backup_dir, cache_dir)
+ except OSError as e:
+ if e.errno != errno.ENOENT:
+ raise
+
+
def test_ipa_without_arguments():
"""Test that `ipa` errors out, and prints the help to stderr"""
with CLITestContext(exception=SystemExit) as ctx:
@@ -137,6 +161,7 @@ def test_ambiguous_command_or_topic():
assert h_ctx.stdout != help_ctx.stdout
+
def test_multiline_description():
"""Test that all of a multi-line command description appears in output
"""