99
1010import aiohttp
1111from aioresponses import CallbackResult , aioresponses
12- from callee import Attrs
12+ from yarl import URL
1313
1414from auth0 .asyncify import asyncify
1515from auth0 .authentication import GetToken , Users
@@ -65,7 +65,7 @@ async def test_get(self, mocked):
6565 c = asyncify (Clients )(domain = "example.com" , token = "jwt" )
6666 self .assertEqual (await c .all_async (), payload )
6767 mock .assert_called_with (
68- Attrs ( path = "/ api/v2/clients" ),
68+ URL ( "https://example.com/ api/v2/clients?include_fields=true " ),
6969 allow_redirects = True ,
7070 params = {"include_fields" : "true" },
7171 headers = headers ,
@@ -80,7 +80,7 @@ async def test_post(self, mocked):
8080 data = {"client" : 1 }
8181 self .assertEqual (await c .create_async (data ), payload )
8282 mock .assert_called_with (
83- Attrs ( path = " /api/v2/clients" ),
83+ URL ( "https://example.com /api/v2/clients" ),
8484 allow_redirects = True ,
8585 json = data ,
8686 headers = headers ,
@@ -96,7 +96,7 @@ async def test_post_auth(self, mocked):
9696 await c .login_async (username = "usrnm" , password = "pswd" ), payload
9797 )
9898 mock .assert_called_with (
99- Attrs ( path = " /oauth/token" ),
99+ URL ( "https://example.com /oauth/token" ),
100100 allow_redirects = True ,
101101 json = {
102102 "client_id" : "cid" ,
@@ -121,7 +121,7 @@ async def test_user_info(self, mocked):
121121 await c .userinfo_async (access_token = "access-token-example" ), payload
122122 )
123123 mock .assert_called_with (
124- Attrs ( path = " /userinfo" ),
124+ URL ( "https://example.com /userinfo" ),
125125 headers = {** headers , "Authorization" : "Bearer access-token-example" },
126126 timeout = ANY ,
127127 allow_redirects = True ,
@@ -138,7 +138,7 @@ async def test_file_post(self, mocked):
138138 file_port_headers = headers .copy ()
139139 file_port_headers .pop ("Content-Type" )
140140 mock .assert_called_with (
141- Attrs ( path = " /api/v2/jobs/users-imports" ),
141+ URL ( "https://example.com /api/v2/jobs/users-imports" ),
142142 allow_redirects = True ,
143143 data = {
144144 "connection_id" : "connection-1" ,
@@ -160,7 +160,7 @@ async def test_patch(self, mocked):
160160 data = {"client" : 1 }
161161 self .assertEqual (await c .update_async ("client-1" , data ), payload )
162162 mock .assert_called_with (
163- Attrs ( path = " /api/v2/clients/client-1" ),
163+ URL ( "https://example.com /api/v2/clients/client-1" ),
164164 allow_redirects = True ,
165165 json = data ,
166166 headers = headers ,
@@ -175,7 +175,7 @@ async def test_put(self, mocked):
175175 data = {"factor" : 1 }
176176 self .assertEqual (await g .update_factor_async ("factor-1" , data ), payload )
177177 mock .assert_called_with (
178- Attrs ( path = " /api/v2/guardian/factors/factor-1" ),
178+ URL ( "https://example.com /api/v2/guardian/factors/factor-1" ),
179179 allow_redirects = True ,
180180 json = data ,
181181 headers = headers ,
@@ -189,7 +189,7 @@ async def test_delete(self, mocked):
189189 c = asyncify (Clients )(domain = "example.com" , token = "jwt" )
190190 self .assertEqual (await c .delete_async ("client-1" ), payload )
191191 mock .assert_called_with (
192- Attrs ( path = " /api/v2/clients/client-1" ),
192+ URL ( "https://example.com /api/v2/clients/client-1" ),
193193 allow_redirects = True ,
194194 params = {},
195195 json = None ,
@@ -204,7 +204,7 @@ async def test_shared_session(self, mocked):
204204 async with asyncify (Clients )(domain = "example.com" , token = "jwt" ) as c :
205205 self .assertEqual (await c .all_async (), payload )
206206 mock .assert_called_with (
207- Attrs ( path = "/ api/v2/clients" ),
207+ URL ( "https://example.com/ api/v2/clients?include_fields=true " ),
208208 allow_redirects = True ,
209209 params = {"include_fields" : "true" },
210210 headers = headers ,
0 commit comments