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
Using vcrpy
as a dynamic callback on HTTPretty
#224
Comments
I should also mention that we saw #8 but didn't feel as though it lined up with what we were trying to accomplish. |
This is pretty interesting. Would there be some way to easily route ALL requests through vcrpy? |
Yea, I do something similar as a catch-all endpoint in fakeServer.addFixture('proxy', {
method: 'all',
route: '*',
response: serverNineTrack
}); |
This would be awesome. What turned me away from |
+1 |
A lot of changes have happened to VCRpy since this ticket was opened. As this ticket has become stale and we have a lot of old tickets that need to be groomed, I'm closing this for now to make it easier to see what is still relevant. However if it is still needed, please feel free to re-open or create a new ticket. Thanks! 🙏 |
In Node.js, I have written and used 2 libraries for HTTP mocking/playback:
fixed-server
andeight-track
(currently actuallyspy-server
/nine-track
). The gist isfixed-server
handles routing to determine whether to use a static fixture (e.g. something from disk) or to use a playback utility (e.g.eight-track
).eight-track
is similar tovcrpy
but it doesn't patch underlying libraries -- it only accepts request objects.More info can be found here: http://twolfson.com/2015-01-11-testing-with-other-services
We want to bring this functionality over to Python. Currently, we are using
HTTPretty
for static and pseudo-dynamic responses but nothing with automatic playback likevcrpy
. SinceHTTPretty
has routing built in and supports dynamic responses, we wanted to use it as the "router" (i.e.fixed-server
). This meansvcrpy
would become an optional dynamic callback.https://github.com/gabrielfalcao/HTTPretty/tree/0.8.3#dynamic-responses-through-callbacks
We tried it out and after a bit of fidgeting, we got a wrapper function that can take parameters from
HTTPretty
, make the request viavcrpy
, and return the response information toHTTPretty
.Now that the proof of concept is complete, we would love to add it into
vcrpy
or maybe build a wrapper library that combine the two. Before doing that though, we wanted to get your feedback and thoughts.Side notes: We are actually using
httpretty-fixtures
in Python to make our fixtures more reusable across tests.The text was updated successfully, but these errors were encountered: