Skip to content

Commit

Permalink
Fix failing test for newlines and carriage returns
Browse files Browse the repository at this point in the history
Fix failing test for newlines and carriage returns
  • Loading branch information
francbartoli committed Apr 28, 2024
1 parent f13e96f commit 30aa2c7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_openapi_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 30aa2c7

Please sign in to comment.