python-mocket icon indicating copy to clipboard operation
python-mocket copied to clipboard

Allow specifying strict mode exceptions

Open ento opened this issue 1 year ago • 5 comments

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...

ento avatar Jan 12 '24 21:01 ento

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?

mindflayer avatar Jan 14 '24 14:01 mindflayer

Opened an issue: #218

ento avatar Jan 14 '24 19:01 ento

Amazing work, thank you very much. I'll start working on it soon.

mindflayer avatar Jan 14 '24 19:01 mindflayer

Thanks! I appreciate how mocket is well-maintained.

ento avatar Jan 15 '24 07:01 ento

Quality Gate Failed Quality Gate failed

Failed conditions

3 Security Hotspots

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Feb 02 '24 09:02 sonarqubecloud[bot]