summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testsuite/Testsrc/Testlib/TestEncryption.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/testsuite/Testsrc/Testlib/TestEncryption.py b/testsuite/Testsrc/Testlib/TestEncryption.py
index 7e9d910d8..778d5b963 100644
--- a/testsuite/Testsrc/Testlib/TestEncryption.py
+++ b/testsuite/Testsrc/Testlib/TestEncryption.py
@@ -17,7 +17,12 @@ from common import *
try:
from Bcfg2.Encryption import *
+ HAS_CRYPTO = True
+except ImportError:
+ HAS_CRYPTO = False
+
+if can_skip or HAS_CRYPTO:
class TestEncryption(Bcfg2TestCase):
plaintext = """foo bar
baz
@@ -28,6 +33,10 @@ baz
salt = "01234567"
algo = "des_cbc"
+ @skipUnless(HAS_CRYPTO, "Encryption libraries not found")
+ def setUp(self):
+ pass
+
def test_str_crypt(self):
""" test str_encrypt/str_decrypt """
key = "a simple key"
@@ -193,6 +202,3 @@ baz
self.assertEqual(self.plaintext,
bruteforce_decrypt(crypted, setup=setup,
algorithm=self.algo))
-
-except ImportError:
- pass