Test X-Script-Name

This commit is contained in:
Unrud 2022-01-21 19:56:56 +01:00
parent 0b7e9d73c9
commit 7fde7d5005

View File

@ -65,6 +65,13 @@ permissions: RrWw""")
SCRIPT_NAME="/radicale")
assert headers.get("Location") == "/radicale/.web"
def test_root_http_x_script_name(self) -> None:
"""GET request at "/" with HTTP_X_SCRIPT_NAME."""
for path in ["", "/", "//"]:
_, headers, _ = self.request("GET", path, check=302,
HTTP_X_SCRIPT_NAME="/radicale")
assert headers.get("Location") == "/radicale/.web"
def test_sanitized_path(self) -> None:
"""GET request with unsanitized paths."""
for path, sane_path in [
@ -75,6 +82,9 @@ permissions: RrWw""")
_, headers, _ = self.request("GET", path, check=301,
SCRIPT_NAME="/radicale")
assert headers.get("Location") == "/radicale%s" % sane_path
_, headers, _ = self.request("GET", path, check=301,
HTTP_X_SCRIPT_NAME="/radicale")
assert headers.get("Location") == "/radicale%s" % sane_path
def test_add_event(self) -> None:
"""Add an event."""