Commit 7ced3d12 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Jérome Perrin

test: cookie attribute match is case-insensitive.

parent 92f79504
......@@ -166,9 +166,9 @@ class TestFacebookLogin(ERP5TypeTestCase):
self.portal.ERP5Site_callbackFacebookLogin(code=CODE)
ac_cookie, = [v for (k, v) in response.listHeaders() if k.lower() == 'set-cookie' and '__ac_facebook_hash=' in v]
self.assertIn('; Secure', ac_cookie)
self.assertIn('; HttpOnly', ac_cookie)
self.assertIn('; SameSite=Lax', ac_cookie)
self.assertIn('; secure', ac_cookie.lower())
self.assertIn('; httponly', ac_cookie.lower())
self.assertIn('; samesite=lax', ac_cookie.lower())
def test_create_user_in_ERP5Site_createFacebookUserToOAuth(self):
"""
......
......@@ -215,9 +215,9 @@ class TestGoogleLogin(GoogleLoginTestCase):
getUserEntry_mock.assert_called_once()
ac_cookie, = [v for (k, v) in response.listHeaders() if k.lower() == 'set-cookie' and '__ac_google_hash=' in v]
self.assertIn('; Secure', ac_cookie)
self.assertIn('; HttpOnly', ac_cookie)
self.assertIn('; SameSite=Lax', ac_cookie)
self.assertIn('; secure', ac_cookie.lower())
self.assertIn('; httponly', ac_cookie.lower())
self.assertIn('; samesite=lax', ac_cookie.lower())
def test_create_user_in_ERP5Site_createGoogleUserToOAuth(self):
"""
......
......@@ -134,9 +134,9 @@ class TestOpenIdConnectLogin(OpenIdConnectLoginTestCase):
getUserEntry_mock.assert_called_once()
ac_cookie, = [v for (k, v) in response.listHeaders() if k.lower() == 'set-cookie' and '__ac_openidconnect_hash=' in v]
self.assertIn('; Secure', ac_cookie)
self.assertIn('; HttpOnly', ac_cookie)
self.assertIn('; SameSite=Lax', ac_cookie)
self.assertIn('; secure', ac_cookie.lower())
self.assertIn('; httponly', ac_cookie.lower())
self.assertIn('; samesite=lax', ac_cookie.lower())
def test_existing_user(self):
state=uuid.uuid4().hex
......
......@@ -1586,7 +1586,7 @@ class TestAuthenticationCookie(UserManagementTestCase):
self.assertIn('; Secure', ac_cookie)
# HttpOnly flag so that javascript cannot access cookie
self.assertIn('; HttpOnly', ac_cookie)
self.assertIn('; httponly', ac_cookie.lower())
# SameSite=Lax flag so that cookie is not sent on cross origin requests.
# We set Lax (and not strict) so that opening a link to ERP5 from an
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment