aboutsummaryrefslogtreecommitdiff
path: root/unit-tests.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2017-04-27 01:16:45 -0400
committerRob Austein <sra@hactrn.net>2017-04-27 01:16:45 -0400
commit018b238e7aac5b4a990a28f49323b821246c9f66 (patch)
tree2a16470f10cbc09ec82941480ec432f828e1835e /unit-tests.py
parent9c9f26fa04882cdc1ddb01410688f4d2651782af (diff)
Decorator doesn't work properly with --all-tests, use runtime check.
Diffstat (limited to 'unit-tests.py')
-rw-r--r--unit-tests.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/unit-tests.py b/unit-tests.py
index 10aa810..f0f5fb2 100644
--- a/unit-tests.py
+++ b/unit-tests.py
@@ -132,6 +132,10 @@ class TestCase(unittest.TestCase):
self.endTime = datetime.datetime.now()
super(TestCase, self).tearDown()
+ def skipUnlessAll(self, reason):
+ if not args.all_tests:
+ self.skipTest(reason)
+
class TextTestResult(unittest.TextTestResult):
def addSuccess(self, test):
@@ -197,15 +201,12 @@ class TestPIN(TestCase):
self.assertRaises(HAL_ERROR_FORBIDDEN, hsm.is_logged_in, user2)
hsm.logout()
- @unittest.skipUnless(args.all_tests, "Slow")
def test_login_wheel(self):
self.login_logout(HAL_USER_WHEEL)
- @unittest.skipUnless(args.all_tests, "Slow")
def test_login_so(self):
self.login_logout(HAL_USER_SO)
- @unittest.skipUnless(args.all_tests, "Slow")
def test_login_user(self):
self.login_logout(HAL_USER_NORMAL)
@@ -292,18 +293,19 @@ class TestPKeyGen(TestCaseLoggedIn):
def test_gen_sign_verify_rsa_1024_sha256(self):
self.gen_sign_verify_rsa(HAL_DIGEST_ALGORITHM_SHA256, 1024)
- @unittest.skipUnless(args.all_tests, "Slow")
def test_gen_sign_verify_rsa_2048_sha384(self):
+ self.skipUnlessAll("Slow")
self.gen_sign_verify_rsa(HAL_DIGEST_ALGORITHM_SHA384, 2048)
- @unittest.skipUnless(args.all_tests, "Hideously slow")
def test_gen_sign_verify_rsa_4096_sha512(self):
+ self.skipUnlessAll("Hideously slow")
self.gen_sign_verify_rsa(HAL_DIGEST_ALGORITHM_SHA512, 4096)
def test_gen_unsupported_length(self):
with self.assertRaises(HAL_ERROR_BAD_ARGUMENTS):
hsm.pkey_generate_rsa(1028).delete()
+
class TestPKeyHashing(TestCaseLoggedIn):
"""
Tests involving various ways of doing the hashing for public key operations.