From 03481a11840d57e6e8d089099b70a1bd5446c8b4 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Sun, 16 Nov 2025 17:02:04 +0100 Subject: [PATCH] add support for remote host+useragent --- radicale/tests/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/radicale/tests/__init__.py b/radicale/tests/__init__.py index 73179efe..9a57e6fd 100644 --- a/radicale/tests/__init__.py +++ b/radicale/tests/__init__.py @@ -80,6 +80,8 @@ class BaseTest: if http_if_match is not None and not isinstance(http_if_match, str): raise TypeError("http_if_match argument must be %r, not %r" % (str, type(http_if_match))) + remote_useragent = kwargs.pop("remote_useragent", None) + remote_host = kwargs.pop("remote_host", None) environ: Dict[str, Any] = {k.upper(): v for k, v in kwargs.items()} for k, v in environ.items(): if not isinstance(v, str): @@ -91,6 +93,10 @@ class BaseTest: login.encode(encoding)).decode() if http_if_match: environ["HTTP_IF_MATCH"] = http_if_match + if remote_useragent: + environ["HTTP_USER_AGENT"] = remote_useragent + if remote_host: + environ["REMOTE_ADDR"] = remote_host environ["REQUEST_METHOD"] = method.upper() environ["PATH_INFO"] = path if data is not None: