Router rollback settings
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
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 base_url, and in turn bases, for a router.
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?
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.
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
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
19f2e24c41a475a1b20e334c2064647203f3cd22