diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2017-10-06 16:58:11 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2018-02-06 19:10:02 +0100 |
commit | 9a05a93b28657eb7b9a02ff69c3968514cefd06a (patch) | |
tree | 4942902950685e0c9259d75b4f93f07c00531af5 | |
parent | 269462a3111b86dbee9b1c2614be5a41bdfe2fa1 (diff) | |
download | m2crypto-9a05a93b28657eb7b9a02ff69c3968514cefd06a.tar.gz |
Restore RSA tests
-rw-r--r-- | setup.cfg | 2 | ||||
-rw-r--r-- | tests/test_rsa.py | 11 |
2 files changed, 7 insertions, 6 deletions
@@ -7,4 +7,4 @@ tag_svn_revision = 0 ignore = E402,N806,N803,N802,E501 [pydocstyle] -ignore = D10,D203 +ignore = D10,D203,D213 diff --git a/tests/test_rsa.py b/tests/test_rsa.py index 0a3b609..85c0e49 100644 --- a/tests/test_rsa.py +++ b/tests/test_rsa.py @@ -42,18 +42,20 @@ class RSATestCase(unittest.TestCase): def pp_callback(self, *args): # The passphrase for rsa.priv2.pem is 'qwerty'. - return 'qwerty' + return b'qwerty' def pp2_callback(self, *args): # Misbehaving passphrase callback. - pass + return b'blabla' + + def test_rsa_exceptions(self): + with self.assertRaises(RSA.RSAError): + RSA.rsa_error() def test_loadkey_junk(self): with self.assertRaises(RSA.RSAError): RSA.load_key(self.errkey) - @unittest.skipIf(six.PY3, - 'test_loadkey_pp hangs under python3') def test_loadkey_pp(self): rsa = RSA.load_key(self.privkey2, self.pp_callback) self.assertEqual(len(rsa), 1024) @@ -61,7 +63,6 @@ class RSATestCase(unittest.TestCase): b'\000\000\000\003\001\000\001') # aka 65537 aka 0xf4 self.assertEqual(rsa.check_key(), 1) - @unittest.skipIf(six.PY3, 'test_loadkey_pp_bad_cp hangs under python3') def test_loadkey_pp_bad_cb(self): with self.assertRaises(RSA.RSAError): RSA.load_key(self.privkey2, self.pp2_callback) |