@@ -889,7 +889,7 @@ def test_same_name_different_domain_not_deduped():
889889def test_storage_state_returns_copy ():
890890 cookies = [{"name" : "a" , "value" : "1" , "domain" : "x" , "path" : "/" }]
891891 ctx = _IsolatedAPIRequestContext (cookies = cookies )
892- state = ctx .storage_state ()
892+ state = ctx .get_storage_state ()
893893 assert state == {"cookies" : cookies }
894894 # Mutating returned state shouldn't affect internal jar
895895 state ["cookies" ].append ({"name" : "b" })
@@ -898,7 +898,7 @@ def test_storage_state_returns_copy():
898898
899899def test_storage_state_empty ():
900900 ctx = _IsolatedAPIRequestContext ()
901- assert ctx .storage_state () == {"cookies" : []}
901+ assert ctx .get_storage_state () == {"cookies" : []}
902902
903903
904904def test_malformed_set_cookie_skipped ():
@@ -980,7 +980,7 @@ def test_handle_response_cookies_add_cookie_failure():
980980def test_mocked_storage_state ():
981981 driver = _make_mock_driver ([{"name" : "x" , "value" : "y" }])
982982 ctx = APIRequestContext (driver )
983- state = ctx .storage_state ()
983+ state = ctx .get_storage_state ()
984984 assert state == {"cookies" : [{"name" : "x" , "value" : "y" }]}
985985
986986
@@ -990,7 +990,7 @@ def test_mocked_storage_state_to_file():
990990 with tempfile .NamedTemporaryFile (suffix = ".json" , delete = False , mode = "w" ) as f :
991991 tmp = f .name
992992 try :
993- ctx .storage_state (path = tmp )
993+ ctx .get_storage_state (path = tmp )
994994 data = json .loads (Path (tmp ).read_text ())
995995 assert data ["cookies" ][0 ]["name" ] == "x"
996996 finally :
@@ -1003,7 +1003,7 @@ def test_storage_state_with_pathlib():
10031003 with tempfile .NamedTemporaryFile (suffix = ".json" , delete = False , mode = "w" ) as f :
10041004 tmp = Path (f .name )
10051005 try :
1006- ctx .storage_state (path = tmp )
1006+ ctx .get_storage_state (path = tmp )
10071007 data = json .loads (tmp .read_text ())
10081008 assert data ["cookies" ][0 ]["name" ] == "x"
10091009 finally :
@@ -1022,7 +1022,7 @@ def test_new_context_with_storage_state_dict():
10221022 driver = _make_mock_driver ()
10231023 ctx = APIRequestContext (driver )
10241024 isolated = ctx .new_context (storage_state = {"cookies" : [{"name" : "a" , "value" : "1" }]})
1025- state = isolated .storage_state ()
1025+ state = isolated .get_storage_state ()
10261026 assert len (state ["cookies" ]) == 1
10271027 assert state ["cookies" ][0 ]["name" ] == "a"
10281028 isolated .dispose ()
@@ -1036,7 +1036,7 @@ def test_new_context_with_storage_state_file():
10361036 tmp = f .name
10371037 try :
10381038 isolated = ctx .new_context (storage_state = tmp )
1039- state = isolated .storage_state ()
1039+ state = isolated .get_storage_state ()
10401040 assert state ["cookies" ][0 ]["name" ] == "b"
10411041 isolated .dispose ()
10421042 finally :
@@ -1051,7 +1051,7 @@ def test_new_context_with_storage_state_pathlib():
10511051 tmp = Path (f .name )
10521052 try :
10531053 isolated = ctx .new_context (storage_state = tmp )
1054- state = isolated .storage_state ()
1054+ state = isolated .get_storage_state ()
10551055 assert state ["cookies" ][0 ]["name" ] == "c"
10561056 isolated .dispose ()
10571057 finally :
@@ -1062,7 +1062,7 @@ def test_new_context_empty_storage_state():
10621062 driver = _make_mock_driver ()
10631063 ctx = APIRequestContext (driver )
10641064 isolated = ctx .new_context (storage_state = {"cookies" : []})
1065- assert isolated .storage_state () == {"cookies" : []}
1065+ assert isolated .get_storage_state () == {"cookies" : []}
10661066 isolated .dispose ()
10671067
10681068
@@ -1144,7 +1144,7 @@ def test_storage_state_unwritable_path():
11441144 driver = _make_mock_driver ([{"name" : "x" , "value" : "y" }])
11451145 ctx = APIRequestContext (driver )
11461146 with pytest .raises (OSError , match = "Cannot write" ):
1147- ctx .storage_state (path = "/nonexistent_dir_abc123/state.json" )
1147+ ctx .get_storage_state (path = "/nonexistent_dir_abc123/state.json" )
11481148
11491149
11501150def test_host_only_cookie_skipped_when_current_url_unavailable ():
@@ -1261,7 +1261,7 @@ def test_new_context_storage_state_dict_no_cookies_key():
12611261 driver = _make_mock_driver ()
12621262 ctx = APIRequestContext (driver )
12631263 isolated = ctx .new_context (storage_state = {"other" : "data" })
1264- state = isolated .storage_state ()
1264+ state = isolated .get_storage_state ()
12651265 assert state ["cookies" ] == []
12661266 isolated .dispose ()
12671267
@@ -1595,7 +1595,7 @@ def test_e2e_isolated_storage_state_roundtrip(base_url):
15951595 """Save isolated context state to file, load into new context, verify cookies work."""
15961596 ctx1 = _IsolatedAPIRequestContext (base_url = base_url )
15971597 ctx1 .get ("/set_cookie?name=rt&value=roundtrip" )
1598- state = ctx1 .storage_state ()
1598+ state = ctx1 .get_storage_state ()
15991599 ctx1 .dispose ()
16001600
16011601 # Create new context from saved state
0 commit comments