File tree 4 files changed +54
-1
lines changed
4 files changed +54
-1
lines changed Original file line number Diff line number Diff line change @@ -18,3 +18,6 @@ coverage.xml
18
18
junit /
19
19
htmldocs /
20
20
utils /docker /dist /
21
+ Pipfile
22
+ Pipfile.lock
23
+ .venv /
Original file line number Diff line number Diff line change @@ -246,7 +246,11 @@ def locals_to_params(args: Dict) -> Dict:
246
246
if key == "self" :
247
247
continue
248
248
if args [key ] is not None :
249
- copy [key ] = args [key ]
249
+ copy [key ] = (
250
+ args [key ]
251
+ if not isinstance (args [key ], Dict )
252
+ else locals_to_params (args [key ])
253
+ )
250
254
return copy
251
255
252
256
Original file line number Diff line number Diff line change @@ -48,6 +48,29 @@ async def test_should_use_proxy(
48
48
assert await page .title () == "Served by the proxy"
49
49
50
50
51
+ async def test_proxy_should_allow_none_for_optional_settings (
52
+ context_factory : "Callable[..., asyncio.Future[BrowserContext]]" , server : Server
53
+ ) -> None :
54
+ server .set_route (
55
+ "/target.html" ,
56
+ lambda r : (
57
+ r .write (b"<html><title>Served by the proxy</title></html>" ),
58
+ r .finish (),
59
+ ),
60
+ )
61
+ context = await context_factory (
62
+ proxy = {
63
+ "server" : f"localhost:{ server .PORT } " ,
64
+ "username" : None ,
65
+ "password" : None ,
66
+ "bypass" : None ,
67
+ }
68
+ )
69
+ page = await context .new_page ()
70
+ await page .goto ("http://non-existent.com/target.html" )
71
+ assert await page .title () == "Served by the proxy"
72
+
73
+
51
74
async def test_should_use_proxy_for_second_page (
52
75
context_factory : "Callable[..., Awaitable[BrowserContext]]" , server : Server
53
76
) -> None :
Original file line number Diff line number Diff line change @@ -46,6 +46,29 @@ async def test_should_use_proxy(
46
46
assert await page .title () == "Served by the proxy"
47
47
48
48
49
+ async def test_proxy_should_allow_none_for_optional_settings (
50
+ browser_factory : "Callable[..., asyncio.Future[Browser]]" , server : Server
51
+ ) -> None :
52
+ server .set_route (
53
+ "/target.html" ,
54
+ lambda r : (
55
+ r .write (b"<html><title>Served by the proxy</title></html>" ),
56
+ r .finish (),
57
+ ),
58
+ )
59
+ browser = await browser_factory (
60
+ proxy = {
61
+ "server" : f"localhost:{ server .PORT } " ,
62
+ "username" : None ,
63
+ "password" : None ,
64
+ "bypass" : None ,
65
+ }
66
+ )
67
+ page = await browser .new_page ()
68
+ await page .goto ("http://non-existent.com/target.html" )
69
+ assert await page .title () == "Served by the proxy"
70
+
71
+
49
72
async def test_should_use_proxy_for_second_page (
50
73
browser_factory : "Callable[..., asyncio.Future[Browser]]" , server : Server
51
74
) -> None :
You can’t perform that action at this time.
0 commit comments