diff --git a/ipatests/test_integration/test_ipahealthcheck.py b/ipatests/test_integration/test_ipahealthcheck.py index 67aa10438..84c02dfd3 100644 --- a/ipatests/test_integration/test_ipahealthcheck.py +++ b/ipatests/test_integration/test_ipahealthcheck.py @@ -7,12 +7,12 @@ Tests to verify that the ipa-healthcheck scenarios from __future__ import absolute_import -from ipatests.test_integration.base import IntegrationTest -from ipatests.pytest_ipa.integration import tasks +import json + from ipalib import api from ipapython.ipaldap import realm_to_serverid - -import json +from ipatests.pytest_ipa.integration import tasks +from ipatests.test_integration.base import IntegrationTest HEALTHCHECK_LOG = "/var/log/ipa/healthcheck/healthcheck.log" HEALTHCHECK_SYSTEMD_FILE = ( @@ -108,6 +108,7 @@ DEFAULT_PKI_KRA_CERTS = [ "auditSigningCert cert-pki-kra", ] + def run_healthcheck(host, source=None, check=None, output_type="json"): """ Run ipa-healthcheck on the remote host and return the result @@ -505,6 +506,19 @@ class TestIpaHealthCheck(IntegrationTest): assert check["result"] == "SUCCESS" assert check["kw"]["key"] in SRV_RECORDS + def test_ipa_healthcheck_output_indent(self): + """ + This test case checks whether default (2) indentation is applied + to output without it being implicitly stated + """ + cmd = self.master.run_command(["ipa-healthcheck", + "--source", + "ipahealthcheck.meta.services"], + raiseonerr=False) + output_str = cmd.stdout_text + output_json = json.loads(output_str) + assert output_str == "{}\n".format(json.dumps(output_json, indent=2)) + def test_ipa_healthcheck_remove(self): """ This testcase checks the removal of of healthcheck tool