From 30aa2c78a6b7ce280ffa67f9dc8146e1c390563e Mon Sep 17 00:00:00 2001 From: Francesco Bartoli Date: Sun, 28 Apr 2024 02:24:17 +0200 Subject: [PATCH] Fix failing test for newlines and carriage returns Fix failing test for newlines and carriage returns --- tests/test_openapi_contract.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_openapi_contract.py b/tests/test_openapi_contract.py index d214912..a4562da 100644 --- a/tests/test_openapi_contract.py +++ b/tests/test_openapi_contract.py @@ -8,6 +8,15 @@ @schema.parametrize() def test_api(case): """Test the API with API-KEY protection.""" + if case.path_parameters: + if case.path_parameters.get("jobId"): + job_id = case.path_parameters.get("jobId") + if r"\n" or r"\r" in job_id: + case.path_parameters["jobId"] = job_id.strip() + if "%0A" in job_id: + case.path_parameters["jobId"] = job_id.replace("%0A", "") + if "%0D" in job_id: + case.path_parameters["jobId"] = job_id.replace("%0D", "") case.headers = {"X-API-KEY": "pygeoapi"} response = case.call() case.validate_response(response)