@@ -85,7 +85,7 @@ def test_flexible_auth_accepts_x_goog_api_key(monkeypatch):
8585 ) == "secret"
8686
8787
88- def test_admin_remote_browser_helper_uses_asyncsession (monkeypatch ):
88+ def test_admin_remote_browser_helper_uses_httpx (monkeypatch ):
8989 calls = []
9090
9191 class FakeResponse :
@@ -95,7 +95,10 @@ class FakeResponse:
9595 def json (self ):
9696 return {"success" : True , "token" : "abc" }
9797
98- class FakeSession :
98+ class FakeAsyncClient :
99+ def __init__ (self , ** kwargs ):
100+ calls .append ({"client_kwargs" : kwargs })
101+
99102 async def __aenter__ (self ):
100103 return self
101104
@@ -110,7 +113,7 @@ async def request(self, method, url, **kwargs):
110113 })
111114 return FakeResponse ()
112115
113- monkeypatch .setattr (admin_module , "AsyncSession " , FakeSession )
116+ monkeypatch .setattr (admin_module . httpx , "AsyncClient " , FakeAsyncClient )
114117
115118 status_code , payload , response_text = asyncio .run (
116119 admin_module ._sync_json_http_request (
@@ -126,6 +129,11 @@ async def request(self, method, url, **kwargs):
126129 assert payload == {"success" : True , "token" : "abc" }
127130 assert response_text == '{"success": true, "token": "abc"}'
128131 assert calls == [
132+ {
133+ "client_kwargs" : {
134+ "follow_redirects" : True ,
135+ },
136+ },
129137 {
130138 "method" : "POST" ,
131139 "url" : "https://example.com/api/v1/custom-score" ,
@@ -136,7 +144,6 @@ async def request(self, method, url, **kwargs):
136144 "Content-Type" : "application/json; charset=utf-8" ,
137145 },
138146 "timeout" : 15 ,
139- "impersonate" : "chrome120" ,
140147 "json" : {"website_url" : "https://example.com" },
141148 },
142149 }
0 commit comments