Test: base-path utledes fra SOAPBOX_SITE_URL

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JcEy43fNYpwg6K6oTKakWR
This commit is contained in:
Ole-Morten Duesund 2026-08-26 15:04:33 +02:00
commit 7e79084dd9

View file

@ -296,3 +296,21 @@ def test_sitemap_and_open_graph(client, cfg):
assert sm.status_code == 200
assert "<loc>https://blog.example.no/</loc>" in sm.text
assert "<loc>https://blog.example.no/og-test/</loc>" 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 == ""