summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-01-16 14:00:19 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-01-16 14:01:03 -0500
commit6eda4318b38106c32d0fa1297d52614e288b0265 (patch)
tree9318da5b0983740eb0cc1c13ce80fd3ea4efaa10 /testsuite
parent973243c744c38e8930428f63340dfa59c9e1db2a (diff)
downloadbcfg2-6eda4318b38106c32d0fa1297d52614e288b0265.tar.gz
bcfg2-6eda4318b38106c32d0fa1297d52614e288b0265.tar.bz2
bcfg2-6eda4318b38106c32d0fa1297d52614e288b0265.zip
testsuite: fixed the way Bcfg2.Encryption unit tests are skipped
Diffstat (limited to 'testsuite')
-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