From d77efc17dd3eb256c444051b8b1c50fd406eb5bf Mon Sep 17 00:00:00 2001 From: Jens Diemer Date: Thu, 30 Oct 2025 21:42:37 +0100 Subject: [PATCH] Allow "__DOMAIN__" placeholder in expect_effective_url See: https://forum.yunohost.org/t/package-ci-problems/40649/3 --- lib/curl_tests.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/curl_tests.py b/lib/curl_tests.py index bd60422..5580309 100644 --- a/lib/curl_tests.py +++ b/lib/curl_tests.py @@ -190,14 +190,18 @@ def code_was_expected(code: int) -> bool: raise ValueError("expect_return_code should be list or int") errors = [] - if expect_effective_url is None and "/yunohost/sso" in effective_url: + + if expect_effective_url: + expect_effective_url = expect_effective_url.replace("__DOMAIN__", APP_DOMAIN) + if expect_effective_url != effective_url: + errors.append( + f"Ended up on URL '{effective_url}', but was expecting '{expect_effective_url}'" + ) + elif "/yunohost/sso" in effective_url: errors.append( f"The request was redirected to yunohost's portal ({effective_url})" ) - if expect_effective_url and expect_effective_url != effective_url: - errors.append( - f"Ended up on URL '{effective_url}', but was expecting '{expect_effective_url}'" - ) + if not code_was_expected(code): errors.append(f"Got return code {code}, but was expecting {expect_return_code}") if expect_title is None and "Welcome to nginx" in title: