python-mocket
python-mocket copied to clipboard
Allow specifying strict mode exceptions
I'm trying to use a library that sends test stats to a remote server in the background, and tests that use Mocket in strict mode would fail intermittently when the library tries to make an HTTP request.
This PR adds a new strict_mode_allowed: list[str | tuple[str, int]]
parameter to Mocketizer
, which specifies which host or host and port can be made requests against even in strict mode.
Suggestions for a better name for the parameter would be welcome, if any. What some other libraries use...
-
HTTPretty's unmerged PR:
whitelist
-
WebMock, a Ruby library:
allow
Hi @ento, thanks for contributing to Mocket.
Would would be the use-case for adding exceptions to Strict Mode, this feature is suppose to check if your mock continues to work consistently, avoiding regressions. Could we please discuss it in an issue before talking about code itself?
Opened an issue: #218
Amazing work, thank you very much. I'll start working on it soon.
Thanks! I appreciate how mocket is well-maintained.