mirror of
https://github.com/pretix/pretix.git
synced 2026-05-03 14:54:04 +00:00
Emulate secure request in samesite tests
This commit is contained in:
@@ -121,8 +121,9 @@ def test_with_forwarded_host(env, client):
|
||||
'Safari/534.59.10',
|
||||
])
|
||||
def test_cookie_samesite_none(env, client, agent):
|
||||
client.post('/mrmcd/2015/cart/add', HTTP_HOST='example.com', HTTP_USER_AGENT=agent)
|
||||
r = client.get('/mrmcd/2015/', HTTP_HOST='example.com', HTTP_USER_AGENT=agent)
|
||||
client.post('/mrmcd/2015/cart/add', HTTP_HOST='example.com', HTTP_USER_AGENT=agent,
|
||||
secure=True)
|
||||
r = client.get('/mrmcd/2015/', HTTP_HOST='example.com', HTTP_USER_AGENT=agent, secure=True)
|
||||
assert r.client.cookies['pretix_csrftoken']['samesite'] == 'None'
|
||||
assert r.client.cookies['pretix_session']['samesite'] == 'None'
|
||||
|
||||
@@ -139,6 +140,6 @@ def test_cookie_samesite_none(env, client, agent):
|
||||
'Safari/534.59.10',
|
||||
])
|
||||
def test_cookie_samesite_none_only_on_compatible_browsers(env, client, agent):
|
||||
client.post('/mrmcd/2015/cart/add', HTTP_HOST='example.com', HTTP_USER_AGENT=agent)
|
||||
r = client.get('/mrmcd/2015/', HTTP_HOST='example.com', HTTP_USER_AGENT=agent)
|
||||
client.post('/mrmcd/2015/cart/add', HTTP_HOST='example.com', HTTP_USER_AGENT=agent, secure=True)
|
||||
r = client.get('/mrmcd/2015/', HTTP_HOST='example.com', HTTP_USER_AGENT=agent, secure=True)
|
||||
assert not r.client.cookies['pretix_csrftoken'].get('samesite')
|
||||
|
||||
Reference in New Issue
Block a user