33pytestmark = pytest .mark .asyncio
44
55
6- async def test_set_and_remove (bidi_session , top_context ,
7- prepare_context , get_headers_methods_invariant , url , set_extra_headers ):
6+ async def test_set_and_remove (top_context ,
7+ prepare_context , get_headers_methods_invariant , set_extra_headers ):
88 await prepare_context (top_context )
99
1010 original_headers = await get_headers_methods_invariant (top_context )
@@ -23,8 +23,31 @@ async def test_set_and_remove(bidi_session, top_context,
2323 assert original_headers == await get_headers_methods_invariant (top_context )
2424
2525
26- async def test_multiple_headers (bidi_session , top_context ,
27- prepare_context , get_headers_methods_invariant , url , set_extra_headers ):
26+ async def test_set_and_unsubscribe_from_network (bidi_session , top_context ,
27+ prepare_context , get_headers_methods_invariant , set_extra_headers , subscribe_events ):
28+ await prepare_context (top_context )
29+
30+ await subscribe_events (events = ["network.beforeRequestSent" ])
31+
32+ await set_extra_headers (
33+ headers = [{
34+ "name" : "some_header_name" ,
35+ "value" : {
36+ "type" : "string" ,
37+ "value" : "some_header_value"
38+ }}],
39+ contexts = [top_context ["context" ]])
40+
41+ # Make sure extra headers are still added after unsubscribing from network
42+ # events.
43+ await bidi_session .session .unsubscribe (events = ["network.beforeRequestSent" ])
44+
45+ new_headers = await get_headers_methods_invariant (top_context )
46+ assert new_headers ["some_header_name" ] == ["some_header_value" ]
47+
48+
49+ async def test_multiple_headers (top_context ,
50+ prepare_context , get_headers_methods_invariant , set_extra_headers ):
2851 await prepare_context (top_context )
2952
3053 original_headers = await get_headers_methods_invariant (top_context )
0 commit comments