Skip to content

Commit a6cbc20

Browse files
committed
Clubbed test cases for same attribute into single.
1 parent aa54e50 commit a6cbc20

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

Lib/test/test_http_cookies.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,14 @@ def test_set_secure_httponly_attrs(self):
121121
self.assertEqual(C.output(),
122122
'Set-Cookie: Customer="WILE_E_COYOTE"; HttpOnly; Secure')
123123

124-
def test_samesite_strict_attrs(self):
125-
C = cookies.SimpleCookie('Customer="WILE_E_COYOTE"')
126-
C['Customer']['samesite'] = "Strict"
127-
self.assertEqual(C.output(),
128-
'Set-Cookie: Customer="WILE_E_COYOTE"; SameSite=Strict')
129-
130-
def test_samesite_lax_attrs(self):
131-
C = cookies.SimpleCookie('Customer="WILE_E_COYOTE"')
132-
C['Customer']['samesite'] = "Lax"
133-
self.assertEqual(C.output(),
134-
'Set-Cookie: Customer="WILE_E_COYOTE"; SameSite=Lax')
124+
def test_samesite_attrs(self):
125+
samesite_values = ("Strict", "Lax")
126+
for val in samesite_values:
127+
with self.subTest(val=val):
128+
C = cookies.SimpleCookie('Customer="WILE_E_COYOTE"')
129+
C['Customer']['samesite'] = val
130+
self.assertEqual(C.output(),
131+
'Set-Cookie: Customer="WILE_E_COYOTE"; SameSite=%s' % val)
135132

136133
def test_secure_httponly_false_if_not_present(self):
137134
C = cookies.SimpleCookie()

0 commit comments

Comments
 (0)