فهرست منبع

Test X-Script-Name

Unrud 4 سال پیش
والد
کامیت
7fde7d5005
1فایلهای تغییر یافته به همراه10 افزوده شده و 0 حذف شده
  1. 10 0
      radicale/tests/test_base.py

+ 10 - 0
radicale/tests/test_base.py

@@ -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."""