From 03a18717c3d9fc180c7fefb32631d274892c3139 Mon Sep 17 00:00:00 2001 From: Madhuri Upadhye Date: Thu, 4 Jul 2024 16:27:09 +0530 Subject: [PATCH] Test: housekeeping: added assertion error messages Added assertion error messages on failures. Signed-off-by: Madhuri Upadhye --- .../system/tests/test_sss_ssh_knownhosts.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/tests/system/tests/test_sss_ssh_knownhosts.py b/src/tests/system/tests/test_sss_ssh_knownhosts.py index da29e22fe64..121f953ea98 100644 --- a/src/tests/system/tests/test_sss_ssh_knownhosts.py +++ b/src/tests/system/tests/test_sss_ssh_knownhosts.py @@ -54,10 +54,10 @@ def test_sss_ssh_knownhosts__by_name(client: Client, ipa: IPA, public_keys: list client.sssd.start() result = client.sss_ssh_knownhosts(hostname) - assert result.rc == 0 - assert len(public_keys) == len(result.stdout_lines) + assert result.rc == 0, "Did not get OpenSSH known hosts public keys" + assert len(public_keys) == len(result.stdout_lines), "Did not get expected number of public keys" for key in public_keys: - assert f"{hostname} {key}" in result.stdout_lines + assert f"{hostname} {key}" in result.stdout_lines, "Did not get expected public keys" @pytest.mark.ticket(gh=5518) @@ -86,10 +86,10 @@ def test_sss_ssh_knownhosts__by_shortname(client: Client, ipa: IPA, public_keys: client.sssd.start() result = client.sss_ssh_knownhosts("ssh") - assert result.rc == 0 - assert len(public_keys) == len(result.stdout_lines) + assert result.rc == 0, "Did not get OpenSSH known hosts public keys" + assert len(public_keys) == len(result.stdout_lines), "Did not get expected number of public keys" for key in public_keys: - assert f"ssh {key}" in result.stdout_lines + assert f"{hostname} {key}" in result.stdout_lines, "Did not get expected public keys" @pytest.mark.ticket(gh=5518) @@ -116,7 +116,7 @@ def test_sss_ssh_knownhosts__by_ip(client: Client, ipa: IPA, public_keys: list[s client.sssd.start() result = client.sss_ssh_knownhosts(ip) - assert result.rc == 0 - assert len(public_keys) == len(result.stdout_lines) + assert result.rc == 0, "Did not get OpenSSH known hosts public keys" + assert len(public_keys) == len(result.stdout_lines), "Did not get expected number of public keys" for key in public_keys: - assert f"{ip} {key}" in result.stdout_lines + assert f"{hostname} {key}" in result.stdout_lines, "Did not get expected public keys"