mindflayer / python-mocket

a socket mock framework - for all kinds of socket animals, web-clients included
BSD 3-Clause "New" or "Revised" License
279 stars 41 forks source link

Allow specifying strict mode exceptions #214

Closed ento closed 5 months ago

ento commented 6 months ago

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

mindflayer commented 6 months ago

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?

ento commented 6 months ago

Opened an issue: #218

mindflayer commented 6 months ago

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

ento commented 6 months ago

Thanks! I appreciate how mocket is well-maintained.

sonarcloud[bot] commented 5 months ago

Quality Gate Failed Quality Gate failed

Failed conditions

3 Security Hotspots

See analysis details on SonarCloud