From e17a83d3b3799c8e8f950504b4d2023c1e6893d1 Mon Sep 17 00:00:00 2001 From: yt-ms <71541861+yt-ms@users.noreply.github.com> Date: Mon, 19 Oct 2020 18:33:59 +0100 Subject: [PATCH] chore: pin version of httx and also test for encoding of non-ascii chars in URLs --- setup.cfg | 2 +- tests/unit/api/test_structurizr_client.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/setup.cfg b/setup.cfg index 1f5a49a2..a7962e27 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,7 +35,7 @@ keywords = zip_safe = True install_requires = depinfo - httpx + httpx ~= 0.16 importlib_metadata; python_version <'3.8' ordered-set pydantic diff --git a/tests/unit/api/test_structurizr_client.py b/tests/unit/api/test_structurizr_client.py index 30f4abb9..52db1171 100644 --- a/tests/unit/api/test_structurizr_client.py +++ b/tests/unit/api/test_structurizr_client.py @@ -23,7 +23,7 @@ from typing import List import pytest -from httpx import Request, Response +from httpx import URL, Request, Response from pytest_mock import MockerFixture from structurizr.api.structurizr_client import StructurizrClient @@ -122,10 +122,10 @@ def test_httpx_response_raw_path_behaviour(): As the httpx library is evolving rapidly, this is a defensive test to make sure that `Response.raw_path` continues to behave as we need for StructurizrClient, in - particular not HTTP-escaping parameters. + particular not HTTP-escaping parameters, but still ASCII-encoding the URL. """ - request = Request(method="GET", url="http://someserver:8081/some/path?param=a+b") - assert request.url.raw_path.decode("ascii") == "/some/path?param=a+b" + url = URL("http://example.com:8080/api/test?q=motörhead") + assert url.raw_path.decode("ascii") == "/api/test?q=mot%C3%B6rhead" def test_add_headers_authentication(client: StructurizrClient, mocker):