Data pattern matching for lists broken between 0.20.2 and 0.21.1
Using httpx==0.25.1
Test case:
def test_respx_data_list():
with respx.mock:
respx.post("http://example.com", data={"foo": ["bar"]})
httpx.post("http://example.com", data={"foo": ["bar"]})
In 0.20.2 this test passes as expected. In 0.21.1 it fails with a AllMockedAssertionError
You're right, this looks like a bug .. looking in to it
@alex-young please try #264 with your code, if possible. Thanks.
@lundberg I tested #264 and it works with our tests. Thanks for fixing so quickly!
I dunno if this is related, but there's another issue with Data pattern matching.
If you add a boolean value to data={"someboolean": True}, it doesn't match the given mock.
Steps to reproduce:
import httpx
import pytest
@pytest.mark.respx(assert_all_called=True, assert_all_mocked=True)
def test_respx_httpx_bug(
respx_mock,
) -> None:
respx_mock.post(
"https://domain.com/test",
data={
"customer": "1",
"boolean_value": True,
},
).mock(return_value=httpx.Response(200, json={"id": "123456"}))
response = httpx.post(
"https://domain.com/test",
data={
"customer": "1",
"boolean_value": True,
},
)
I noticed httpx gets properly that converted into urlencoded like: boolean_value=true, whereas respx converts that to boolean_value=True