Skip to content

Commit

Permalink
Fix 3.7 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjmcgrath committed Nov 22, 2023
1 parent cc7e656 commit 99110e9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
6 changes: 5 additions & 1 deletion auth0/test_async/test_async_auth0.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ def callback(url, **kwargs):
return callback, mock


class TestAuth0(unittest.IsolatedAsyncioTestCase):
@unittest.skipIf(
not hasattr(unittest, "IsolatedAsyncioTestCase"),
"python 3.7 doesn't have IsolatedAsyncioTestCase",
)
class TestAuth0(getattr(unittest, "IsolatedAsyncioTestCase", object)):
@pytest.mark.asyncio
@aioresponses()
async def test_get(self, mocked):
Expand Down
20 changes: 17 additions & 3 deletions auth0/test_async/test_async_token_verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ def get_pem_bytes(rsa_public_key):
)


class TestAsyncAsymmetricSignatureVerifier(unittest.IsolatedAsyncioTestCase):
@unittest.skipIf(
not hasattr(unittest, "IsolatedAsyncioTestCase"),
"python 3.7 doesn't have IsolatedAsyncioTestCase",
)
class TestAsyncAsymmetricSignatureVerifier(
getattr(unittest, "IsolatedAsyncioTestCase", object)
):
@pytest.mark.asyncio
@aioresponses()
async def test_async_asymmetric_verifier_fetches_key(self, mocked):
Expand All @@ -69,7 +75,11 @@ async def test_async_asymmetric_verifier_fetches_key(self, mocked):
self.assertEqual(get_pem_bytes(key), RSA_PUB_KEY_1_PEM)


class TestAsyncJwksFetcher(unittest.IsolatedAsyncioTestCase):
@unittest.skipIf(
not hasattr(unittest, "IsolatedAsyncioTestCase"),
"python 3.7 doesn't have IsolatedAsyncioTestCase",
)
class TestAsyncJwksFetcher(getattr(unittest, "IsolatedAsyncioTestCase", object)):
@pytest.mark.asyncio
@aioresponses()
@unittest.mock.patch(
Expand Down Expand Up @@ -225,7 +235,11 @@ async def test_async_fails_to_fetch_jwks_json_after_retrying_twice(self, mocked)
self.assertEqual(mock.call_count, 2)


class TestAsyncTokenVerifier(unittest.IsolatedAsyncioTestCase):
@unittest.skipIf(
not hasattr(unittest, "IsolatedAsyncioTestCase"),
"python 3.7 doesn't have IsolatedAsyncioTestCase",
)
class TestAsyncTokenVerifier(getattr(unittest, "IsolatedAsyncioTestCase", object)):
@pytest.mark.asyncio
@aioresponses()
async def test_RS256_token_signature_passes(self, mocked):
Expand Down
6 changes: 5 additions & 1 deletion auth0/test_async/test_asyncify.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ def callback(url, **kwargs):
return callback, mock


class TestAsyncify(unittest.IsolatedAsyncioTestCase):
@unittest.skipIf(
not hasattr(unittest, "IsolatedAsyncioTestCase"),
"python 3.7 doesn't have IsolatedAsyncioTestCase",
)
class TestAsyncify(getattr(unittest, "IsolatedAsyncioTestCase", object)):
@pytest.mark.asyncio
@aioresponses()
async def test_get(self, mocked):
Expand Down

0 comments on commit 99110e9

Please sign in to comment.