88 PurePythonRSAKey = CryptographyRSAKey = PyCryptoRSAKey = None
99from jose .constants import ALGORITHMS
1010
11- from .test_RSA import private_key
11+ from .test_RSA import PRIVATE_KEYS
1212
1313CRYPTO_BACKENDS = (
1414 pytest .param (PurePythonRSAKey , id = "python_rsa" ),
@@ -27,7 +27,8 @@ class TestBackendRsaCompatibility(object):
2727
2828 @pytest .mark .parametrize ("BackendSign" , CRYPTO_BACKENDS )
2929 @pytest .mark .parametrize ("BackendVerify" , CRYPTO_BACKENDS )
30- def test_signing_parity (self , BackendSign , BackendVerify ):
30+ @pytest .mark .parametrize ("private_key" , PRIVATE_KEYS )
31+ def test_signing_parity (self , BackendSign , BackendVerify , private_key ):
3132 key_sign = BackendSign (private_key , ALGORITHMS .RS256 )
3233 key_verify = BackendVerify (private_key , ALGORITHMS .RS256 ).public_key ()
3334
@@ -43,7 +44,8 @@ def test_signing_parity(self, BackendSign, BackendVerify):
4344 @pytest .mark .parametrize ("encoding" , ENCODINGS )
4445 @pytest .mark .parametrize ("BackendFrom" , CRYPTO_BACKENDS )
4546 @pytest .mark .parametrize ("BackendTo" , CRYPTO_BACKENDS )
46- def test_public_key_to_pem (self , BackendFrom , BackendTo , encoding ):
47+ @pytest .mark .parametrize ("private_key" , PRIVATE_KEYS )
48+ def test_public_key_to_pem (self , BackendFrom , BackendTo , encoding , private_key ):
4749 key = BackendFrom (private_key , ALGORITHMS .RS256 )
4850 key2 = BackendTo (private_key , ALGORITHMS .RS256 )
4951
@@ -54,7 +56,8 @@ def test_public_key_to_pem(self, BackendFrom, BackendTo, encoding):
5456 @pytest .mark .parametrize ("encoding" , ENCODINGS )
5557 @pytest .mark .parametrize ("BackendFrom" , CRYPTO_BACKENDS )
5658 @pytest .mark .parametrize ("BackendTo" , CRYPTO_BACKENDS )
57- def test_private_key_to_pem (self , BackendFrom , BackendTo , encoding ):
59+ @pytest .mark .parametrize ("private_key" , PRIVATE_KEYS )
60+ def test_private_key_to_pem (self , BackendFrom , BackendTo , encoding , private_key ):
5861 key = BackendFrom (private_key , ALGORITHMS .RS256 )
5962 key2 = BackendTo (private_key , ALGORITHMS .RS256 )
6063
@@ -72,7 +75,8 @@ def test_private_key_to_pem(self, BackendFrom, BackendTo, encoding):
7275 @pytest .mark .parametrize ("encoding_load" , ENCODINGS )
7376 @pytest .mark .parametrize ("BackendFrom" , CRYPTO_BACKENDS )
7477 @pytest .mark .parametrize ("BackendTo" , CRYPTO_BACKENDS )
75- def test_public_key_load_cycle (self , BackendFrom , BackendTo , encoding_save , encoding_load ):
78+ @pytest .mark .parametrize ("private_key" , PRIVATE_KEYS )
79+ def test_public_key_load_cycle (self , BackendFrom , BackendTo , encoding_save , encoding_load , private_key ):
7680 key = BackendFrom (private_key , ALGORITHMS .RS256 )
7781
7882 pem_pub_reference = key .public_key ().to_pem (pem_format = encoding_save ).strip ()
@@ -86,7 +90,8 @@ def test_public_key_load_cycle(self, BackendFrom, BackendTo, encoding_save, enco
8690 @pytest .mark .parametrize ("encoding_load" , ENCODINGS )
8791 @pytest .mark .parametrize ("BackendFrom" , CRYPTO_BACKENDS )
8892 @pytest .mark .parametrize ("BackendTo" , CRYPTO_BACKENDS )
89- def test_private_key_load_cycle (self , BackendFrom , BackendTo , encoding_save , encoding_load ):
93+ @pytest .mark .parametrize ("private_key" , PRIVATE_KEYS )
94+ def test_private_key_load_cycle (self , BackendFrom , BackendTo , encoding_save , encoding_load , private_key ):
9095 key = BackendFrom (private_key , ALGORITHMS .RS256 )
9196
9297 pem_reference = key .to_pem (pem_format = encoding_save ).strip ()
0 commit comments