File tree Expand file tree Collapse file tree 2 files changed +37
-2
lines changed
Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Original file line number Diff line number Diff line change 11
22try :
3- from jose .backends .pycrypto_backend import RSAKey # noqa: F401
3+ from jose .backends .cryptography_backend import CryptographyRSAKey as RSAKey # noqa: F401
44except ImportError :
55 try :
6- from jose .backends .cryptography_backend import CryptographyRSAKey as RSAKey # noqa: F401
6+ from jose .backends .pycrypto_backend import RSAKey # noqa: F401
77 except ImportError :
88 from jose .backends .rsa_backend import RSAKey # noqa: F401
99
Original file line number Diff line number Diff line change 1+ """Test the default import handling."""
2+ try :
3+ from jose .backends .rsa_backend import RSAKey as PurePythonRSAKey
4+ except ImportError :
5+ PurePythonRSAKey = None
6+ try :
7+ from jose .backends .cryptography_backend import CryptographyRSAKey , CryptographyECKey
8+ except ImportError :
9+ CryptographyRSAKey = CryptographyECKey = None
10+ try :
11+ from jose .backends .pycrypto_backend import RSAKey as PyCryptoRSAKey
12+ except ImportError :
13+ PyCryptoRSAKey = None
14+ try :
15+ from jose .backends .ecdsa_backend import ECDSAECKey as PurePythonECDSAKey
16+ except ImportError :
17+ PurePythonRSAKey = None
18+
19+ from jose .backends import ECKey , RSAKey
20+
21+
22+ def test_default_ec_backend ():
23+ if CryptographyECKey is not None :
24+ assert ECKey is CryptographyECKey
25+ else :
26+ assert ECKey is PurePythonECDSAKey
27+
28+
29+ def test_default_rsa_backend ():
30+ if CryptographyRSAKey is not None :
31+ assert RSAKey is CryptographyRSAKey
32+ elif PyCryptoRSAKey is not None :
33+ assert RSAKey is PyCryptoRSAKey
34+ else :
35+ assert RSAKey is PurePythonRSAKey
You can’t perform that action at this time.
0 commit comments