Open carlosvargas opened 8 years ago
Bah, just realized that I could have written:
with self.recorder.use_cassette(cassette_name):
with self.cli_runner.isolation() as runner:
like
with self.recorder.use_cassette(cassette_name) as cassette, self.cli_runner.isolation() as runner:
if anyone wants to, I could change it to the latter.
@carlosvargas for nested context managers...you can use contextlib.nested http://stackoverflow.com/a/3025119/1510751
@ueg1990 contextlib.nested
has been deprecated since 2.7 (https://docs.python.org/2/library/contextlib.html#contextlib.nested)
ah....didnt know that
I wrote some unit tests a while ago using https://github.com/patrys/httmock
I manually saved the json
data.
Never ended up trying to merge them. I think I had forgot about it...
I will have a look at all these changes when I get time. Looks interesting :+1:
This adds some integration tests for the most basic commands by comparing the stdout output after we have parsed it. This is to help prevent changes to formatting, unicode text not displaying, etc.
It uses Betamax to modify
reqests
so that we can save the request body to a file. It will then use this file in any subsequent calls so that the "response" for a specific endpoint is always the same.I'm also using
click.testing.CliRunner.isolation
function (src) so that I can easily get a hold of the stdout output.