URL: https://github.com/freeipa/freeipa/pull/1576 Author: Rezney Title: #1576: [Backport][ipa-4-5] [Backport][ipa-4-6] - Help cache test Action: opened
PR body: """ This PR was opened automatically because PR #1570 was pushed to ipa-4-6 and backport to ipa-4-5 is required. """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/1576/head:pr1576 git checkout pr1576
From d1a8b15eb5a7f43c59511d1f46fd1126f5a49ed3 Mon Sep 17 00:00:00 2001 From: Michal Reznik <mrez...@redhat.com> Date: Fri, 15 Dec 2017 14:49:40 +0100 Subject: [PATCH] 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 <chei...@redhat.com> --- ipatests/test_cmdline/test_help.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ipatests/test_cmdline/test_help.py b/ipatests/test_cmdline/test_help.py index b28aa2303d..919e60885a 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 @@ -70,6 +73,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: @@ -134,6 +158,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 """
_______________________________________________ FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org