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 == ""