From f0f2c2645ef5aa0a065e2b5a2063d57d85f74d56 Mon Sep 17 00:00:00 2001 From: Sumedh Sidhaye Date: Fri, 31 Jan 2020 14:14:52 +0530 Subject: [PATCH] Added a test to check if ipa host-find --pkey-only does not return SSH public key It checks if 'SSH public key fingerprint' is not present in the output of the command Related: https://pagure.io/freeipa/issue/8029 Signed-off-by: Sumedh Sidhaye Reviewed-By: Florence Blanc-Renaud --- ipatests/test_xmlrpc/test_host_plugin.py | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/ipatests/test_xmlrpc/test_host_plugin.py b/ipatests/test_xmlrpc/test_host_plugin.py index 355769993..cb6975a7d 100644 --- a/ipatests/test_xmlrpc/test_host_plugin.py +++ b/ipatests/test_xmlrpc/test_host_plugin.py @@ -131,6 +131,12 @@ def host4(request): return tracker.make_fixture(request) +@pytest.fixture(scope='class') +def host5(request): + tracker = HostTracker(name=u'testhost5') + return tracker.make_fixture(request) + + @pytest.fixture(scope='class') def lab_host(request): name = u'testhost1' @@ -261,6 +267,29 @@ class TestCRUD(XMLRPC_test): res = command()['result'] assert len(res) == 1 + def test_host_find_pkey_only(self, host5): + # test host-find with --pkey-only + host5.ensure_exists() + command = host5.make_create_command(force=True) + host5.update(dict(ipasshpubkey=sshpubkey), + expected_updates=dict( + description=['Test host '], + fqdn=[host5.fqdn], + ipasshpubkey=[sshpubkey], + has_keytab=False, + has_password=False, + krbprincipalname=['host/%s@%s' % + (host5.fqdn, api.env.realm)], + krbcanonicalname=['host/%s@%s' % + (host5.fqdn, api.env.realm)], + managedby_host=[host5.fqdn], + sshpubkeyfp=[sshpubkeyfp], )) + command = host5.make_find_command( + fqdn=host5.fqdn, pkey_only=True) + result = command()['result'] + for item in result: + assert 'ipasshpubkey' not in item.keys() + def test_try_rename(self, host): host.ensure_exists() command = host.make_update_command(