@@ -54,7 +54,13 @@ def get_pem_bytes(rsa_public_key):
5454 )
5555
5656
57- class TestAsyncAsymmetricSignatureVerifier (unittest .IsolatedAsyncioTestCase ):
57+ @unittest .skipIf (
58+ not hasattr (unittest , "IsolatedAsyncioTestCase" ),
59+ "python 3.7 doesn't have IsolatedAsyncioTestCase" ,
60+ )
61+ class TestAsyncAsymmetricSignatureVerifier (
62+ getattr (unittest , "IsolatedAsyncioTestCase" , object )
63+ ):
5864 @aioresponses ()
5965 async def test_async_asymmetric_verifier_fetches_key (self , mocked ):
6066 callback , mock = get_callback (200 , JWKS_RESPONSE_SINGLE_KEY )
@@ -67,7 +73,11 @@ async def test_async_asymmetric_verifier_fetches_key(self, mocked):
6773 self .assertEqual (get_pem_bytes (key ), RSA_PUB_KEY_1_PEM )
6874
6975
70- class TestAsyncJwksFetcher (unittest .IsolatedAsyncioTestCase ):
76+ @unittest .skipIf (
77+ not hasattr (unittest , "IsolatedAsyncioTestCase" ),
78+ "python 3.7 doesn't have IsolatedAsyncioTestCase" ,
79+ )
80+ class TestAsyncJwksFetcher (getattr (unittest , "IsolatedAsyncioTestCase" , object )):
7181 @aioresponses ()
7282 async def test_async_get_jwks_json_twice_on_cache_expired (self , mocked ):
7383 fetcher = AsyncJwksFetcher (JWKS_URI , cache_ttl = 1 )
@@ -213,7 +223,11 @@ async def test_async_fails_to_fetch_jwks_json_after_retrying_twice(self, mocked)
213223 self .assertEqual (mock .call_count , 2 )
214224
215225
216- class TestAsyncTokenVerifier (unittest .IsolatedAsyncioTestCase ):
226+ @unittest .skipIf (
227+ not hasattr (unittest , "IsolatedAsyncioTestCase" ),
228+ "python 3.7 doesn't have IsolatedAsyncioTestCase" ,
229+ )
230+ class TestAsyncTokenVerifier (getattr (unittest , "IsolatedAsyncioTestCase" , object )):
217231 @aioresponses ()
218232 async def test_RS256_token_signature_passes (self , mocked ):
219233 callback , mock = get_callback (200 , {"keys" : [PUBLIC_KEY ]})
0 commit comments