I'm trying to test how is @retry.retry decorator for my custom method works. For this I need to emulate the situation when response has HTTP statuses in ranges 2xx, 3xx, 4xx. Right now I have an example with requests_mock:
def some_method(request, *_):
...
return {'jsonrpc': '2.0', 'id': 1, 'result': True}
with requests_mock.Mocker() as mock:
mock.post('mock://test', json=some_method)
...
...
my_sender.send(...) # <- tinyrpc.RPCClient.get_proxy somewhere inside
What some_method should return to emulate 404 for example, if it's possible?
In general, the situation is as follows: mocker returns json rpc 2.0 now. I would like to test the case when http status has specific codes, for some of which I need to make a repeated request. How can I do this emulation?