bb0ded
From 3baae8d1bd0a0c4c707314524289e86e6ecbc0df Mon Sep 17 00:00:00 2001
bb0ded
From: Alexander Bokovoy <abokovoy@redhat.com>
bb0ded
Date: Mon, 14 Mar 2022 21:09:36 +0200
bb0ded
Subject: [PATCH] test_otp: do not use paramiko unless it is really needed
bb0ded
bb0ded
paramiko cannot be used in FIPS mode. We have few tests that import
bb0ded
generic methods from test_otp (add_token/del_token) and those tests fail
bb0ded
in FIPS mode due to unconditional 'import paramiko'.
bb0ded
bb0ded
Instead, move 'import paramiko' to the ssh_2f() helper which is not used
bb0ded
in FIPS mode (the whole SSH 2FA test is skipped then).
bb0ded
bb0ded
Related: https://pagure.io/freeipa/issue/9119
bb0ded
bb0ded
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
bb0ded
Reviewed-By: Francisco Trivino <ftrivino@redhat.com>
bb0ded
---
bb0ded
 ipatests/test_integration/test_otp.py | 3 ++-
bb0ded
 1 file changed, 2 insertions(+), 1 deletion(-)
bb0ded
bb0ded
diff --git a/ipatests/test_integration/test_otp.py b/ipatests/test_integration/test_otp.py
bb0ded
index bec76d205bf37699483b65ebbc5613cbbb466bb4..04bef4626077e727654898b07a76acab4f1d5971 100644
bb0ded
--- a/ipatests/test_integration/test_otp.py
bb0ded
+++ b/ipatests/test_integration/test_otp.py
bb0ded
@@ -5,7 +5,6 @@
bb0ded
 """
bb0ded
 import base64
bb0ded
 import logging
bb0ded
-import paramiko
bb0ded
 import pytest
bb0ded
 import re
bb0ded
 import time
bb0ded
@@ -102,6 +101,8 @@ def ssh_2f(hostname, username, answers_dict, port=22):
bb0ded
             logger.info(
bb0ded
                 "Answer to ssh prompt is: '%s'", answers_dict[prmpt_str])
bb0ded
         return resp
bb0ded
+
bb0ded
+    import paramiko
bb0ded
     trans = paramiko.Transport((hostname, port))
bb0ded
     trans.connect()
bb0ded
     trans.auth_interactive(username, answer_handler)
bb0ded
-- 
bb0ded
2.34.1
bb0ded