Closed slingshotvfx closed 3 months ago
Thanks, hopefully a simple fix
@slingshotvfx please try #259 and see if it solves your issue
Not sure if it's related but I also encounter issues when I run (as a unittest.TestCase
method):
@respx.mock
def test_file_upload(self):
FILE_DATA = {
"upload": ("image/png", io.BytesIO(b"some image content"), "image/png")
}
respx.patch("https://api.example.com/endpoint/123", files=FILE_DATA)
httpx.patch("https://api.example.com/endpoint/123", files=FILE_DATA)
This raises:
raise AllMockedAssertionError(f"RESPX: {request!r} not mocked!")
respx.models.AllMockedAssertionError: RESPX: <Request('PATCH', 'https://api.example.com/endpoint/123')> not mocked!
@pierremonico this is not related and is certainly a bug in the new files
pattern feature that was added in 0.21.0
.
Please open a new issue with your test example. My bet is that the pattern doesn't handle BytesIO
, which should be a simple fix.
@lundberg #259 fixes my issue. Thanks for looking into it!
As of the latest version
v0.21.0
, None values in data lookups don't work:output:
This test passes successfully in
v0.20.2
The following do work:
So there's just a bug somewhere translating None to ""