-
Notifications
You must be signed in to change notification settings - Fork 39
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
Router rollback settings #186
base: master
Are you sure you want to change the base?
Conversation
Adds a function to allow changing of settings on a per-snapshot basis
Thanks for the PR @Mojken. I also gave this a try but got stuck on the bases. The intention of this requested configuration feature is for example to be able to change Changing the bases like you do will work, but only apply for new added routes, if any existing routes is present on the router when re-configuring the base_url, the existing routes will still have the old bases merged to their pattern. |
That sounds like expected behaviour to me. I wouldn't expect things I've set up before to be changed as a side-effect of me changing the configuration of the router. It doesn't seem like a very difficult thing to fix, perhaps adding a method to update old routes is a reasonable next step? |
Actually I would. At least when standing on the outside looking in. Since it isn't really revealed that bases are merged together with routes to form and "freeze" a pattern. e.g. import respx
mocker = respx.mock(base_url="http://localhost/")
mocker.get("some/path")
other_mocker = mocker(base_url="http://some.where/")
# After doing this, my initial assumption would be that 'other_mocker' is now capturing the following request
import httpx
with other_mocker:
httpx.Client().get("http://some.where/some/path") Just wanted to clarify what kind of behaviour I'm interested in, the snippet above should resemble my use case |
19f2e24c41a475a1b20e334c2064647203f3cd22 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- [ ]
Adds router settings to the rollback functionality, as well as a function
configure()
which allows changing the settings of the router, creating a new snapshot.Closes #181