From be8a8dd35a631563aa6dba5612dd19ec8b5aaac4 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sat, 31 Dec 2022 09:02:57 -0600 Subject: [PATCH] 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 --- tests/functional_tests.py | 8 ++++---- tests/test_pages.py | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/functional_tests.py b/tests/functional_tests.py index f914be4..eb7fb18 100644 --- a/tests/functional_tests.py +++ b/tests/functional_tests.py @@ -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' diff --git a/tests/test_pages.py b/tests/test_pages.py index 410e34e..244abe0 100644 --- a/tests/test_pages.py +++ b/tests/test_pages.py @@ -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):