jamielennox / requests-mock

Mocked responses for the requests library
https://requests-mock.readthedocs.io
Apache License 2.0
440 stars 70 forks source link

New Utility Extension for requests_mock: Multi-API Mocker #240

Open jab3z opened 10 months ago

jab3z commented 10 months ago

Hello!

I've developed Multi-API Mocker, a utility enhancing requests_mock for easier mocking of multiple API calls in pytest. It aims to improve test readability and maintainability in complex API scenarios.

You can find it here.

Your work inspired its creation, and I hope it can be a valuable tool for the community. Any feedback or sharing would be greatly appreciated.

Best, Dacian Popute Ottu.com

jamielennox commented 7 months ago

That looks really cool and i hope it's going well! Just because of the projects i worked on i was always more familiar with unittest, i did the pytest extension and learnt a bit but always felt there was something a lot more that could be done there.

There's a contrib folder i had set up in requests-mock, but honestly I'd keep your own project as i'm always responsive on the issues (as seen by this delay) and it allows you to be way more opinionated about the design.

Let me know if there's anything that you need, or that could be tweaked to make it easier to consume, it should be fine but I didn't explicitly think about the subclass use case so i expect there are some private classes that you might need (for example).

jab3z commented 7 months ago

It's going very well, already implemented it on our internal projects, and we're happy with it as we managed to drop the cassette implementation we had earlier.

Yes, subclasses are one of the backbone components of the package, especially for usability.

Maybe adding the package in requests_mocks documentation under a new section Extensions? Just saying. We mostly developed this package for our own, but others are welcomed to use it.

Thanks!