From 33cceae834d85c8e670379fa26f6f31c313098ca Mon Sep 17 00:00:00 2001 From: Anas Khan <83116240+anxkhn@users.noreply.github.com> Date: Sat, 4 Jul 2026 18:33:59 +0530 Subject: [PATCH] test: Assert HttpOnly is unset on a minimal cookie The HttpOnly-default assertion in test_set_basic_cookie checked the nonstandard attribute 'httpOnpy', a typo for 'HttpOnly'. Since a cookie never carries the misspelled key, has_nonstandard_attr('httpOnpy') is always False and 'assert not ...' passed unconditionally, so the test never verified that a minimal cookie leaves HttpOnly off. Use the correct 'HttpOnly' key (matching how _cookies.py stores and reads the flag, and the sibling assertion in test_set_cookie_with_all_attributes) so the check actually validates the default. --- tests/unit/sessions/test_cookies.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/sessions/test_cookies.py b/tests/unit/sessions/test_cookies.py index 61f39d6385..a59dcfe9b2 100644 --- a/tests/unit/sessions/test_cookies.py +++ b/tests/unit/sessions/test_cookies.py @@ -40,7 +40,7 @@ def test_set_basic_cookie() -> None: assert cookie.value == 'value' assert cookie.path == '/' assert not cookie.secure - assert not cookie.has_nonstandard_attr('httpOnpy') + assert not cookie.has_nonstandard_attr('HttpOnly') def test_set_cookie_with_all_attributes(session_cookies: SessionCookies, cookie_dict: CookieParam) -> None: