From 495f5f8a0dee04d44cc4bec0cf11815501469e28 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 24 Apr 2026 08:37:19 -0700 Subject: [PATCH] radicale: tests: functional: Better checking for well-known URLs - When SOGO app is enabled, radicale functional tests fail. Tests: - Enable SOGO app and run radicale functional tests. They fail without patch and pass with the patch. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- .../modules/radicale/tests/test_functional.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/plinth/modules/radicale/tests/test_functional.py b/plinth/modules/radicale/tests/test_functional.py index e1db34592..a35dde93e 100644 --- a/plinth/modules/radicale/tests/test_functional.py +++ b/plinth/modules/radicale/tests/test_functional.py @@ -83,21 +83,21 @@ def _set_access_rights(browser, access_rights_type): def _calendar_is_available(browser): """Return whether calendar is available at well-known URL.""" - conf = functional.config['DEFAULT'] - url = functional.base_url + '/.well-known/caldav' - logging.captureWarnings(True) - request = requests.get(url, auth=(conf['username'], conf['password']), - verify=False) - logging.captureWarnings(False) - return request.status_code != 404 + return _well_known_available(browser, '/.well-known/caldav') def _addressbook_is_available(browser): """Return whether addressbook is available at well-known URL.""" + return _well_known_available(browser, '/.well-known/carddav') + + +def _well_known_available(browser, wellknown_url: str): + """Return whether a well-known URL redirects to radicale.""" conf = functional.config['DEFAULT'] - url = functional.base_url + '/.well-known/carddav' + url = functional.base_url + wellknown_url logging.captureWarnings(True) request = requests.get(url, auth=(conf['username'], conf['password']), - verify=False) + verify=False, allow_redirects=False) logging.captureWarnings(False) - return request.status_code != 404 + return (request.status_code == 301 + and request.headers['Location'].endswith('/radicale/'))