-
Notifications
You must be signed in to change notification settings - Fork 553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Stub is still counted even after being removed #979
Comments
support for passing a stub to assert_requested has been added after assert_requested was originally created to make it easier and avoid duplication, but the assertion is made on request registry and not on the stub itself. |
stubs do not track their history of requests. |
Well yes, that's what this whole issue is about. They are expected to. According to the semantics and signature of
It would be really great if those methods could work as described (either by simply removing entries from registry, altering the request count, setting some flags, counters, or redesigning the whole registry approach in a different manner). "If it's not documented, it's not a feature, it's a bug." Thanks for looking into it! 👍 |
Test case
Expected behaviour
Test should pass.
Since the stubbed request have been removed, both stub and number of times it have been requested, should not be carried over and should not affect any other stubs.
When I stub the request, make the request, assert the stub, and then remove the stub, I expect the next stub with same url to be a properly isolated object that does not know, and does not care, about anything that happened before, after, or during it's existence.
Instead, we observe a breach of isolation:
Actual behaviour
UPD.
#548 seems to be related.
I guess the problem is
assert_requested
is checking not the stub object, as one would expect from the syntax, but the global registry of requests instead.The text was updated successfully, but these errors were encountered: