pnuckowski / aioresponses

Aioresponses is a helper for mock/fake web requests in python aiohttp package.
MIT License
508 stars 86 forks source link

Enhancement request: allow removal of repeat=True #252

Open rlippmann opened 8 months ago

rlippmann commented 8 months ago

First of all, thanks for this awesome package!

I was looking for a way to remove responses where repeat = True.

My rationale is that I set up pytest fixtures which mock a server working correctly. Generally I just set repeat = True for most cases (i.e. successful login/logout, poll of data from website, etc). But for failure cases I need to create whole new fixtures. It would be easier if I could just pop the repeat = True response and replace it for the test.

I could go in, find the corresponding _requests entry and remove it, but I'd rather not use private objects.

TIA

guilhermeferrari commented 7 months ago

https://github.com/pnuckowski/aioresponses/pull/237 will fix it 🙏🏻

rlippmann commented 7 months ago

I saw that enhancement request. I don't understand why you can't just add the requests in a for loop for that one?