Skip to content

Commit 6696a4a

Browse files
Test: Update misc ipa tests to work correctly on stig
The custom ssh library previously used in the tests does not work correctly on stig as the test are testing sudo, replacing ssh with su to switch user. (cherry picked from commit 07401d6)
1 parent c384b52 commit 6696a4a

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/tests/multihost/ipa/test_misc.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import pytest
1717
from sssd.testlib.common.utils import sssdTools
1818
from sssd.testlib.common.exceptions import SSSDException
19-
from sssd.testlib.common.ssh2_python import run_command_client
2019

2120

2221
@pytest.mark.usefixtures('default_ipa_users', 'reset_password')
@@ -335,7 +334,7 @@ def test_authentication_indicators(multihost, backupsssdconf):
335334
multihost.client[0].run_command(
336335
f'su -l {user} -c "ipa sudorule-add-user testrule2 --users admin"',
337336
raiseonerr=False)
338-
run_command_client(multihost, user, test_password, "sudo -l")
337+
multihost.client[0].run_command(f'su -l {user} -c "sudo -l"')
339338
time.sleep(3)
340339
search = multihost.client[0].run_command(
341340
'fgrep gssapi_ /var/log/sssd/sssd_pam.log | tail -10')
@@ -347,8 +346,7 @@ def test_authentication_indicators(multihost, backupsssdconf):
347346
multihost.client[0].run_command(
348347
f'su -l {user} -c "kinit admin"', stdin_text=test_password,
349348
raiseonerr=False)
350-
run_command_client(multihost, user, test_password, "sudo -l")
351-
349+
multihost.client[0].run_command(f'su -l {user} -c "sudo -l"')
352350
multihost.client[0].run_command(
353351
f'su -l {user} -c "klist"', raiseonerr=False)
354352
multihost.client[0].run_command(
@@ -423,9 +421,10 @@ def test_pass_krb5cname_to_pam(multihost,
423421
multihost.client[0].run_command(
424422
f'su -l {user} -c "sudo -S -l"', stdin_text=test_password,
425423
raiseonerr=False)
426-
result = run_command_client(multihost, user, test_password,
427-
'echo -e "Secret123" | sudo -S /usr/sbin/sssctl domain-list')
428-
assert domain_name in result
424+
result = multihost.client[0].run_command(
425+
f'su -l {user} -c "echo -e \"Secret123\" | sudo -S /usr/sbin/sssctl domain-list"'
426+
)
427+
assert domain_name in result.stdout_text
429428

430429
@staticmethod
431430
def test_ssh_hash_knownhosts(multihost, reset_password, backupsssdconf):
@@ -606,7 +605,7 @@ def test_ssh_expiration_warning(multihost, reset_password, hbac_sshd_rule,
606605

607606
# Test result evaluation
608607
assert ssh_cmd.returncode == 0, "Ssh login failed."
609-
assert "Your password will expire in " in ssh_cmd.stdout_text,\
608+
assert "Your password will expire in " in ssh_cmd.stdout_text, \
610609
"The password expiration notice was not shown."
611610

612611
@staticmethod

0 commit comments

Comments
 (0)