Skip to content

Commit f9c585d

Browse files
committed
Yeeeah, I want it that way 🕺
1 parent fcaf617 commit f9c585d

1 file changed

Lines changed: 11 additions & 17 deletions

File tree

tests/integration/test_client_storage.py

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -818,18 +818,12 @@ def set_sub(var: str, value: str):
818818
input_value_input.send_keys(value)
819819
set_sub_state_button.click()
820820

821-
def test_json_cookie_with_refresh(cookie_id: str, json_value: str):
821+
def _assert_json_cookie_with_refresh(cookie_id: str, json_value: str):
822822
"""Helper function to test JSON cookie values with browser refresh.
823-
824-
This function:
825-
1. Polls for token to ensure app is ready
826-
2. Gets the cookie element
827-
3. Sets the JSON value
828-
4. Asserts the value is displayed correctly
829-
5. Refreshes the browser to trigger cookie hydration
830-
6. Polls for token again to ensure app is ready after refresh
831-
7. Gets the element again (to avoid stale references)
832-
8. Asserts the value is still preserved as a string
823+
824+
Args:
825+
cookie_id: ID of the cookie element to manipulate.
826+
json_value: JSON string to set as the cookie value.
833827
"""
834828
poll_for_token()
835829
element = driver.find_element(By.ID, cookie_id)
@@ -842,21 +836,21 @@ def test_json_cookie_with_refresh(cookie_id: str, json_value: str):
842836
AppHarness.expect(lambda: element.text == json_value)
843837

844838
json_dict = '{"access_token": "redacted", "refresh_token": "redacted", "created_at": 1234567890, "expires_in": 3600}'
845-
test_json_cookie_with_refresh("c1", json_dict)
839+
_assert_json_cookie_with_refresh("c1", json_dict)
846840

847841
json_array = '["item1", "item2", "item3"]'
848-
test_json_cookie_with_refresh("c2", json_array)
842+
_assert_json_cookie_with_refresh("c2", json_array)
849843

850844
complex_json = '{"user": {"id": 123, "name": "test"}, "settings": {"theme": "dark", "notifications": true}, "data": [1, 2, 3]}'
851-
test_json_cookie_with_refresh("c1", complex_json)
845+
_assert_json_cookie_with_refresh("c1", complex_json)
852846

853847
json_with_escapes = (
854848
'{"message": "Hello \\"world\\"", "path": "/api/v1", "count": 42}'
855849
)
856-
test_json_cookie_with_refresh("c2", json_with_escapes)
850+
_assert_json_cookie_with_refresh("c2", json_with_escapes)
857851

858852
empty_json_obj = "{}"
859-
test_json_cookie_with_refresh("c1", empty_json_obj)
853+
_assert_json_cookie_with_refresh("c1", empty_json_obj)
860854

861855
empty_json_array = "[]"
862-
test_json_cookie_with_refresh("c2", empty_json_array)
856+
_assert_json_cookie_with_refresh("c2", empty_json_array)

0 commit comments

Comments
 (0)