From 8e77dfec835563b89245d7b27b3446954a895db6 Mon Sep 17 00:00:00 2001 From: Sergei Maertens Date: Fri, 6 Oct 2023 15:19:18 +0200 Subject: [PATCH] :white_check_mark: Add test for bytestring URL --- tests/test_config_adapter.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test_config_adapter.py b/tests/test_config_adapter.py index c86e55e..b4da204 100644 --- a/tests/test_config_adapter.py +++ b/tests/test_config_adapter.py @@ -112,6 +112,23 @@ def test_relative_urls_are_made_absolute(method): assert m.last_request.url == "https://from-factory.example.com/foo" +@given(method=http_methods) +def test_relative_bytestring_urls_are_made_absolute(method): + adapter = TestConfigAdapter() + client = APIClient.configure_from(adapter) + + with ( + requests_mock.Mocker() as m, + client, + ): + m.register_uri(ANY, ANY) + + client.request(method, b"foo") + + assert len(m.request_history), 1 + assert m.last_request.url == "https://from-factory.example.com/foo" + + @given(method=http_methods) def test_absolute_urls_must_match_base_url(method): adapter = TestConfigAdapter()