getsentry / responses

A utility for mocking out the Python Requests library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Set repeat count for response

efojs opened this issue · comments

Learned the hard way that responses repeat last added response, if it matches request.
But I'd like it to "play" response only once. E.g. by setting repeat=0.
So that it fails when cannot find matching not used response.

The use case? — Want to cover all requests sent in the test with precision.

May call_count help? — I don't think so, call_count is somewhat opposite. It checks the result, but I want to prevent it from happening. call_count will not tell me which requests are not handled.

Maybe it's already implemented and I'm just missing it?

Or what do you think about it? Is it an opportunity to contribute?

Hello,

You probably talking about registry. Please read readme to see how to switch it.

You can always extend registry with custom one

Hello!
Yes, OrderedRegistry does the trick.
Missed that.
Thank you very much!