test full path for stylesheets

I'm going to be screwing around with this code in some future commits so
it's better to be explicit
This commit is contained in:
Brian S. Stephan 2022-12-31 09:02:57 -06:00
parent 0f19fcb174
commit be8a8dd35a
Signed by: bss
GPG Key ID: 3DE06D3180895FCB
2 changed files with 10 additions and 10 deletions

View File

@ -190,15 +190,15 @@ def test_setting_selected_style_includes_cookie(client):
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 b'/static/css/light.css' in response.data
assert b'/static/css/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 b'/static/css/dark.css' in response.data
assert b'/static/css/light.css' not in response.data
assert style_cookie.value == 'dark'

View File

@ -49,22 +49,22 @@ def test_render_with_user_dark_theme(app):
"""Test that a request with the dark theme selected renders the dark theme."""
cookie = dump_cookie("user-style", 'dark')
with app.test_request_context(headers={'COOKIE': cookie}):
assert b'dark.css' in render('base.html').data
assert b'light.css' not in render('base.html').data
assert b'/static/css/dark.css' in render('base.html').data
assert b'/static/css/light.css' not in render('base.html').data
def test_render_with_user_light_theme(app):
"""Test that a request with the light theme selected renders the light theme."""
with app.test_request_context():
assert b'light.css' in render('base.html').data
assert b'dark.css' not in render('base.html').data
assert b'/static/css/light.css' in render('base.html').data
assert b'/static/css/dark.css' not in render('base.html').data
def test_render_with_no_user_theme(app):
"""Test that a request with no theme set renders the light theme."""
with app.test_request_context():
assert b'light.css' in render('base.html').data
assert b'dark.css' not in render('base.html').data
assert b'/static/css/light.css' in render('base.html').data
assert b'/static/css/dark.css' not in render('base.html').data
def test_request_path_to_instance_resource_path(app):