From 7e79084dd926cb84d558f0b2a6f7ba6bef924118 Mon Sep 17 00:00:00 2001 From: Ole-Morten Duesund Date: Wed, 26 Aug 2026 15:04:33 +0200 Subject: [PATCH] Test: base-path utledes fra SOAPBOX_SITE_URL Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01JcEy43fNYpwg6K6oTKakWR --- tests/test_app.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test_app.py b/tests/test_app.py index d13f5e9..e607685 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -296,3 +296,21 @@ def test_sitemap_and_open_graph(client, cfg): assert sm.status_code == 200 assert "https://blog.example.no/" in sm.text assert "https://blog.example.no/og-test/" in sm.text + + +def test_base_path_derived_from_site_url(tmp_path): + cfg = load_config( + {"SOAPBOX_DATA_DIR": str(tmp_path / "a"), "SOAPBOX_SITE_URL": "https://x.no/blog/"} + ) + assert cfg.base_path == "/blog" and cfg.site_url == "https://x.no/blog" + cfg = load_config({"SOAPBOX_DATA_DIR": str(tmp_path / "b"), "SOAPBOX_SITE_URL": "https://x.no"}) + assert cfg.base_path == "" + # eksplisitt tom verdi overstyrer (proxy stripper prefikset) + cfg = load_config( + { + "SOAPBOX_DATA_DIR": str(tmp_path / "c"), + "SOAPBOX_SITE_URL": "https://x.no/blog", + "SOAPBOX_BASE_PATH": "", + } + ) + assert cfg.base_path == ""