Skip to content

Commit

Permalink
Update test_asyncify.py
Browse files Browse the repository at this point in the history
  • Loading branch information
evansims committed Aug 15, 2023
1 parent 30a5965 commit 0add577
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions auth0/test_async/test_asyncify.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class TestAsyncify(getattr(unittest, "IsolatedAsyncioTestCase", object)):
@aioresponses()
async def test_get(self, mocked):
callback, mock = get_callback()
mocked.get(clients, callback=callback)
await mocked.get(clients, callback=callback)
c = asyncify(Clients)(domain="example.com", token="jwt")
self.assertEqual(await c.all_async(), payload)
mock.assert_called_with(
Expand All @@ -78,7 +78,7 @@ async def test_get(self, mocked):
@aioresponses()
async def test_post(self, mocked):
callback, mock = get_callback()
mocked.post(clients, callback=callback)
await mocked.post(clients, callback=callback)
c = asyncify(Clients)(domain="example.com", token="jwt")
data = {"client": 1}
self.assertEqual(await c.create_async(data), payload)
Expand All @@ -94,7 +94,7 @@ async def test_post(self, mocked):
@aioresponses()
async def test_post_auth(self, mocked):
callback, mock = get_callback()
mocked.post(token, callback=callback)
await mocked.post(token, callback=callback)
c = asyncify(GetToken)("example.com", "cid", client_secret="clsec")
self.assertEqual(
await c.login_async(username="usrnm", password="pswd"), payload
Expand All @@ -120,7 +120,7 @@ async def test_post_auth(self, mocked):
@aioresponses()
async def test_user_info(self, mocked):
callback, mock = get_callback()
mocked.get(user_info, callback=callback)
await mocked.get(user_info, callback=callback)
c = asyncify(Users)(domain="example.com")
self.assertEqual(
await c.userinfo_async(access_token="access-token-example"), payload
Expand All @@ -137,7 +137,7 @@ async def test_user_info(self, mocked):
@aioresponses()
async def test_file_post(self, mocked):
callback, mock = get_callback()
mocked.post(users_imports, callback=callback)
await mocked.post(users_imports, callback=callback)
j = asyncify(Jobs)(domain="example.com", token="jwt")
users = TemporaryFile()
self.assertEqual(await j.import_users_async("connection-1", users), payload)
Expand All @@ -162,7 +162,7 @@ async def test_file_post(self, mocked):
@aioresponses()
async def test_patch(self, mocked):
callback, mock = get_callback()
mocked.patch(clients, callback=callback)
await mocked.patch(clients, callback=callback)
c = asyncify(Clients)(domain="example.com", token="jwt")
data = {"client": 1}
self.assertEqual(await c.update_async("client-1", data), payload)
Expand All @@ -178,7 +178,7 @@ async def test_patch(self, mocked):
@aioresponses()
async def test_put(self, mocked):
callback, mock = get_callback()
mocked.put(factors, callback=callback)
await mocked.put(factors, callback=callback)
g = asyncify(Guardian)(domain="example.com", token="jwt")
data = {"factor": 1}
self.assertEqual(await g.update_factor_async("factor-1", data), payload)
Expand All @@ -194,7 +194,7 @@ async def test_put(self, mocked):
@aioresponses()
async def test_delete(self, mocked):
callback, mock = get_callback()
mocked.delete(clients, callback=callback)
await mocked.delete(clients, callback=callback)
c = asyncify(Clients)(domain="example.com", token="jwt")
self.assertEqual(await c.delete_async("client-1"), payload)
mock.assert_called_with(
Expand All @@ -210,7 +210,7 @@ async def test_delete(self, mocked):
@aioresponses()
async def test_shared_session(self, mocked):
callback, mock = get_callback()
mocked.get(clients, callback=callback)
await mocked.get(clients, callback=callback)
async with asyncify(Clients)(domain="example.com", token="jwt") as c:
self.assertEqual(await c.all_async(), payload)
mock.assert_called_with(
Expand All @@ -225,10 +225,10 @@ async def test_shared_session(self, mocked):
@aioresponses()
async def test_rate_limit(self, mocked):
callback, mock = get_callback(status=429)
mocked.get(clients, callback=callback)
mocked.get(clients, callback=callback)
mocked.get(clients, callback=callback)
mocked.get(clients, payload=payload)
await mocked.get(clients, callback=callback)
await mocked.get(clients, callback=callback)
await mocked.get(clients, callback=callback)
await mocked.get(clients, payload=payload)
c = asyncify(Clients)(domain="example.com", token="jwt")
rest_client = c._async_client.client
rest_client._skip_sleep = True
Expand All @@ -241,7 +241,7 @@ async def test_rate_limit(self, mocked):
@aioresponses()
async def test_timeout(self, mocked):
callback, mock = get_callback()
mocked.get(clients, callback=callback)
await mocked.get(clients, callback=callback)
c = asyncify(Clients)(domain="example.com", token="jwt", timeout=(8.8, 9.9))
self.assertEqual(await c.all_async(), payload)
mock.assert_called_with(
Expand Down

0 comments on commit 0add577

Please sign in to comment.