Chris Marusich [Thu, 3 Apr 2014 19:08:41 +0000 (12:08 -0700)]
Add a failing test to illustrate a hole in vcrpy's Boto support
This test will fail with the following error:
TypeError: unbound method __init__() must be called with VCRHTTPConnection
instance as first argument (got CertValidatingHTTPSConnection instance instead)
The TypeError is raised because the __init__ method of Boto's
CertValidatingHTTPSConnection (which extends httplib.HTTPConnection) calls
httplib.HTTPConnection.__init__, and during the test httplib.HTTPConnection
actually refers to the patched verison (i.e., VCRHTTPConnection). When
VCRHTTPConnection.__init__ is called, it expects to receive a
VCRHTTPConnection object as its first argument, but instead it receives a
CertValidatingHTTPSConnection object. Because the only ancestor class of
CertValidatingHTTPSConnection is the original, un-patched
httplib.HTTPConnection, the first argument is not considered to be a
VCRHTTPConnection object, so a TypeError is raised.
Kevin McCarthy [Sat, 29 Mar 2014 22:03:38 +0000 (12:03 -1000)]
Revert "Merge pull request #68 from smallcode/patch-1"
Never mind, I do seem to have support for this. I'm not sure
why @smallcode was having issues with it, but I'm going to
beef up the test for it a bit to try to figure out what's broken.
Kevin McCarthy [Sun, 9 Mar 2014 05:22:58 +0000 (19:22 -1000)]
Major Refactor of Stubs
So the stubs were getting out of hand, and while trying to add support for the
putrequest and putheader methods, I had an idea for a cleaner way to handle
the stubs using the VCRHTTPConnection more as a proxy object. So
VCRHTTPConnection and VCRHTTPSConnection no longer inherit from HTTPConnection
and HTTPSConnection. This allowed me to get rid of quite a bit of
copy-and-pasted stdlib code.
Kevin McCarthy [Sun, 8 Dec 2013 01:50:30 +0000 (15:50 -1000)]
Store Headers as a List
This is a backwards-incompatible change that will store headers
as a list rather than a dictionary. The reason being that you can
have multiple values for a single header, and concatenating them
together with commas can create an unparseable string (sometimes
the header values can have commas in them)
Kevin McCarthy [Sun, 10 Nov 2013 03:33:33 +0000 (17:33 -1000)]
Fix Requests so it can gunzip the request body
I wasn't emulating the stateful file-object in my response stub,
so urllib3 wasn't decompressing gzipped bodies properly. This
should fix that problem.
Thanks @bryanhelmig for the motivation to dig into this.
Kevin McCarthy [Tue, 17 Sep 2013 06:09:25 +0000 (20:09 -1000)]
Add support for custom request matchers
This commit not only changes the default method of matching requests
(just match on method and URI instead of the entire request + headers)
but also allows the user to add custom matchers.
Kevin McCarthy [Sun, 15 Sep 2013 20:47:24 +0000 (10:47 -1000)]
Add support for calling httplib.send().
This commit changes the whole core internal flow of requests.
Now, requests are actually physically made lazily when a response
is requested. This allows the entire request to be sent at once.
Otherwise, it would be impossible to compare whether requests have
already been recorded, since httplib.send() allows you to effectively
stream requests over HTTP.
Kevin McCarthy [Sun, 18 Aug 2013 22:04:22 +0000 (12:04 -1000)]
Fix Google test Failure
Let's not use Google to test redirects since it changes depending on your
geographic location. I changed the test to use httpbin.org, since
a lot of our tests already depend on httpbin.org anyway.
Somedays, I'd like to implement my own local mock HTTP server I
can do asserts against. The test suite would just start it up,
and the server would record the requests, which I could then
retrieve and compare.