Ivan Malison
cb05f4163c
Add use_cassette class so functinos that are decorated with use_cassette can be called multiple times.
2014-09-16 23:45:05 -07:00
Kevin McCarthy
3b05d499c3
Merge pull request #78 from mshytikov/feature/cassette-all-played
...
Feature/Cassette#all_played
2014-05-10 11:58:28 -10:00
Kevin McCarthy
83ff73792e
forgot to check in tests
2014-05-10 11:52:36 -10:00
Kevin McCarthy
66c6909021
not really very happy about this
2014-05-10 11:52:35 -10:00
Max Shytikov
bd2121d34e
pep8
2014-05-06 00:46:32 +02:00
Max Shytikov
f9f2b98427
Added tests for Cassette#all_played
2014-05-06 00:46:03 +02:00
Kevin McCarthy
5e295e0603
Serialize dict of lists, use dicts internally
...
There is a weird quirk in HTTP. You can send the same header twice.
For this reason, headers are represented by a dict, with lists as the
values. However, it appears that HTTPlib is completely incapable of
sending the same header twice. This puts me in a weird position: I want
to be able to accurately represent HTTP headers in cassettes, but I
don't want the extra step of always having to do [0] in the general
case, i.e. request.headers['key'][0]
In addition, some servers sometimes send the same header more than once,
and httplib *can* deal with this situation.
Futhermore, I wanted to keep the request and response cassette format as
similar as possible.
For this reason, in cassettes I keep a dict with lists as keys, but once
deserialized into VCR, I keep them as plain, naked dicts.
2014-05-03 17:39:12 -10:00
Max Shytikov
78f6ce46b5
Added test casses and refactored test for Request#port
2014-05-04 02:20:46 +02:00
Max Shytikov
1190a0e62e
Removed default '80' port of uri in tests
2014-05-04 02:11:49 +02:00
Max Shytikov
61e3bdc402
Added tetst for uri and port of Request
2014-05-03 22:31:30 +02:00
Max Shytikov
1ff5d08c8b
Fixed typo
2014-05-02 07:32:18 +02:00
Max Shytikov
65c2797f94
Updated test for filters. Mock replaced with real Request object
2014-05-02 07:32:18 +02:00
Max Shytikov
fbd5049d38
Updated test to use new Request constructor
2014-05-02 07:32:17 +02:00
Max Shytikov
eab10578d5
Make Request headers to be a dict of lists
2014-05-02 07:32:15 +02:00
Max Shytikov
eedafb19ee
Added more test for persist
2014-04-30 02:36:27 +02:00
Max Shytikov
434d6325ea
Udated migration test for yaml. replaced strict content comparision
...
What we care about it is actually data after loading not the
strict format of yaml file
2014-04-30 02:36:27 +02:00
Max Shytikov
1e995c3c9b
Replaced yaml dump of Request object with plain dict dump
2014-04-30 02:36:26 +02:00
Max Shytikov
a3eac1f0ec
Added tests for persist module
2014-04-30 02:36:26 +02:00
Max Shytikov
ee28768a31
Added migration script for old cassettes
2014-04-30 02:36:26 +02:00
Max Shytikov
2fa1aaa1f7
Replaced 'url' mather with 'uri'.
2014-04-30 02:31:11 +02:00
Max Shytikov
7fe55ad8b8
Updated 'set' to be compatible with 2.6
2014-04-30 02:30:08 +02:00
Max Shytikov
4267828a3e
Added 'scheme' to Request with matcher and test
2014-04-30 02:29:25 +02:00
Max Shytikov
5015dbd878
Improved test samples
2014-04-30 02:27:52 +02:00
Max Shytikov
9b188e986f
Added query to Request with matcher and test
2014-04-30 02:27:52 +02:00
Max Shytikov
6b060e5666
Added path to Request with matcher and test
2014-04-30 02:27:52 +02:00
Max Shytikov
bd9fa773e8
Added port to Request with matcher and test
2014-04-30 02:27:52 +02:00
Max Shytikov
18ec57fa73
Added test and impl for Request 'host' attribute
2014-04-30 02:27:52 +02:00
Max Shytikov
6cca703eee
Refactored unit test for matchers
2014-04-30 02:27:52 +02:00
Max Shytikov
edf1df9188
Replaced Request 'host, port, protocol, path' with 'uri'
2014-04-30 02:27:52 +02:00
Max Shytikov
792d665893
Added unit test for matcher 'url'
2014-04-30 02:27:51 +02:00
Max Shytikov
cd32f5114c
Added unit test for matcher 'method'
2014-04-30 02:27:51 +02:00
Kevin McCarthy
e6fdc735e4
Filter Sensitive Data From Requests
...
Add the ability to filter out sensitive data, using one of three
methods: from headers, from a query string, and by using a custom
callback to modify the request.
Closes #67
2014-04-27 11:38:28 -10:00
Kevin McCarthy
6273c32334
Add Exception when JSON Serializing Binary Data
...
Since I can't think of a good way to deal with this, let's just give a
nice error message to point people in the right direction.
Closes #51
2014-04-26 14:31:40 -10:00
Kevin McCarthy
d4494bae50
Let's have the new exceptions subclass basic exception types
2013-12-19 19:43:32 -10:00
Marc Abramowitz
a6806f2f99
Nicer error when cassette doesn't contain request
...
Raise UnhandledHTTPRequestError.
Show name of cassette and request.
2013-12-19 15:41:04 -08:00
Kevin McCarthy
188b57a2fa
Fix API by adding 'responses_of' method
...
`responses_of` replaces `response_of`, since each request can have
several matching responses now.
This breaks backwards compatibility if you are using the
response_of method, so a version bump will be required.
2013-12-01 14:26:35 -10:00
Kevin McCarthy
89403c255c
Record Multiple Matching Requests
...
This change allows us to record multiple matching requests to
the same URL, and then play them back sequentially.
Closes #40 , #41
2013-11-10 12:17:39 -10:00
Kevin McCarthy
deed8cab97
Fix issue #36 - error message for unregistered matcher was broken
2013-09-29 15:56:50 -10:00
Kevin McCarthy
a66f462dcd
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.
2013-09-16 20:46:00 -10:00
Kevin McCarthy
c8299103fb
pep8 fixes
2013-08-23 20:35:43 -10:00
Kevin McCarthy
ec01955c68
lets store the proto too
2013-08-11 15:05:41 -10:00
Kevin McCarthy
a50cebaf21
change response to response_of
2013-08-11 15:05:41 -10:00
Kevin McCarthy
4f0668471e
Refactor again to try to give Cassette a cleaner interface
2013-08-11 15:05:41 -10:00
Kevin McCarthy
ac2f21b318
remove extra whitespace
2013-08-11 15:05:41 -10:00
Kevin McCarthy
e39b48e73b
add a couple more tests, change played api to require request being played
2013-08-11 15:05:41 -10:00
Kevin McCarthy
4cdf5f7483
update cassette unit tests
2013-08-11 15:05:41 -10:00
Kevin McCarthy
166facd0d0
check that cassette contains things before returning
2013-08-11 15:05:40 -10:00
Kevin McCarthy
fb2aa89445
replace cached() with mark_played / play_count
2013-08-11 15:05:40 -10:00
Kevin McCarthy
4fe6f463c3
remove fixtures, remove some dead httpbin assert code
2013-08-11 15:05:40 -10:00
Kevin McCarthy
5f512ca6b2
add unit tests for Cassette implementation
2013-08-11 15:05:39 -10:00