lundberg / respx

Mock HTTPX with awesome request patterns and response side effects 🦋
https://lundberg.github.io/respx
BSD 3-Clause "New" or "Revised" License
581 stars 38 forks source link

Show actuall request when umocked requests are made #250

Closed dolfandringa closed 3 months ago

dolfandringa commented 6 months ago

I have a unittest that uses respx through the pytest fixture to mock the http requests. I changed something in the code, and now a bunch of tests are failing with respx.models.AllMockedAssertionError: RESPX: <Request('POST', 'https://our.partner.example.com/their/webhook')> not mocked!.

So far, hurray for unittests. But it doesn't show me what request was actually made. It would be great if there was some kind of output showing the mocked requests and the actual requests, so I can see the difference. Now i am just guessing what the issue is. Pytest normally can show diffs on assertion errors with plain values.

lundberg commented 6 months ago

The "all mocked assertion" means that respx is active and configured to require every httpx request to match respx mock route, i.e. the request above (https://our.partner.example.com/their/webhook) does not match any route in your respx fixture instance.

Need more details/example, e.g. fixture some the unittest that fails

lundberg commented 6 months ago

Kind-of related to #244

lundberg commented 3 months ago

Need more context, closing this for now. Please re-open if still a problem and/or docs should be adjusted.