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 <ssidhaye@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
This commit is contained in:
Sumedh Sidhaye 2020-01-31 14:14:52 +05:30 committed by Florence Blanc-Renaud
parent 60f746d998
commit f0f2c2645e

View File

@ -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 <testhost5>'],
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(