add a test to ensure style selection works
This commit is contained in:
parent
d2c1c2e3ce
commit
dcf173ab61
@ -52,3 +52,24 @@ def test_that_dir_request_does_not_redirect(client):
|
||||
response = client.get('/subdir/')
|
||||
assert response.status_code == 200
|
||||
assert b'another page' in response.data
|
||||
|
||||
|
||||
def test_setting_selected_style_includes_cookie(client):
|
||||
"""Test that a request with style=foo sets the cookie and renders appropriately."""
|
||||
response = client.get('/')
|
||||
style_cookie = next((cookie for cookie in client.cookie_jar if cookie.name == 'user-style'), None)
|
||||
assert style_cookie is None
|
||||
|
||||
response = client.get('/?style=light')
|
||||
style_cookie = next((cookie for cookie in client.cookie_jar if cookie.name == 'user-style'), None)
|
||||
assert response.status_code == 200
|
||||
assert b'light.css' in response.data
|
||||
assert b'dark.css' not in response.data
|
||||
assert style_cookie.value == 'light'
|
||||
|
||||
response = client.get('/?style=dark')
|
||||
style_cookie = next((cookie for cookie in client.cookie_jar if cookie.name == 'user-style'), None)
|
||||
assert response.status_code == 200
|
||||
assert b'dark.css' in response.data
|
||||
assert b'light.css' not in response.data
|
||||
assert style_cookie.value == 'dark'
|
||||
|
Loading…
Reference in New Issue
Block a user