|
12 | 12 | from callee import Attrs |
13 | 13 |
|
14 | 14 | from auth0.asyncify import asyncify |
15 | | -from auth0.authentication import GetToken |
| 15 | +from auth0.authentication import GetToken, Users |
16 | 16 | from auth0.management import Clients, Guardian, Jobs |
17 | 17 |
|
18 | 18 | clients = re.compile(r"^https://example\.com/api/v2/clients.*") |
19 | 19 | token = re.compile(r"^https://example\.com/oauth/token.*") |
| 20 | +user_info = re.compile(r"^https://example\.com/userinfo.*") |
20 | 21 | factors = re.compile(r"^https://example\.com/api/v2/guardian/factors.*") |
21 | 22 | users_imports = re.compile(r"^https://example\.com/api/v2/jobs/users-imports.*") |
22 | 23 | payload = {"foo": "bar"} |
@@ -111,6 +112,22 @@ async def test_post_auth(self, mocked): |
111 | 112 | timeout=ANY, |
112 | 113 | ) |
113 | 114 |
|
| 115 | + @aioresponses() |
| 116 | + async def test_user_info(self, mocked): |
| 117 | + callback, mock = get_callback() |
| 118 | + mocked.get(user_info, callback=callback) |
| 119 | + c = asyncify(Users)(domain="example.com") |
| 120 | + self.assertEqual( |
| 121 | + await c.userinfo_async(access_token="access-token-example"), payload |
| 122 | + ) |
| 123 | + mock.assert_called_with( |
| 124 | + Attrs(path="/userinfo"), |
| 125 | + headers={**headers, "Authorization": "Bearer access-token-example"}, |
| 126 | + timeout=ANY, |
| 127 | + allow_redirects=True, |
| 128 | + params=None, |
| 129 | + ) |
| 130 | + |
114 | 131 | @aioresponses() |
115 | 132 | async def test_file_post(self, mocked): |
116 | 133 | callback, mock = get_callback() |
|
0 commit comments