From 6eda4318b38106c32d0fa1297d52614e288b0265 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Wed, 16 Jan 2013 14:00:19 -0500 Subject: testsuite: fixed the way Bcfg2.Encryption unit tests are skipped --- testsuite/Testsrc/Testlib/TestEncryption.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'testsuite') 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 -- cgit v1.2.3-1-g7c22