mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-11 01:53:01 +00:00
Compare commits
1 Commits
b122b5c701
...
fix-allow-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ccd772822 |
@@ -310,3 +310,13 @@ def test_post_unicode_match_on_body(tmpdir, httpbin_both):
|
||||
req2 = requests.post(url, data).content
|
||||
|
||||
assert req1 == req2
|
||||
|
||||
|
||||
def test_duplicate_get_allow_playback_repeats(tmpdir, httpbin_both):
|
||||
"""Ensure that duplicate requests are not included in the cassette on record."""
|
||||
with vcr.use_cassette(str(tmpdir.join("allow_repeats.yaml")), allow_playback_repeats=True) as cass:
|
||||
requests.get(httpbin_both + "/same")
|
||||
requests.get(httpbin_both + "/different")
|
||||
requests.get(httpbin_both + "/same")
|
||||
|
||||
assert len(cass) == 2
|
||||
|
||||
@@ -253,7 +253,12 @@ class Cassette:
|
||||
|
||||
def can_play_response_for(self, request):
|
||||
request = self._before_record_request(request)
|
||||
return request and request in self and self.record_mode != RecordMode.ALL and self.rewound
|
||||
return (
|
||||
request
|
||||
and request in self
|
||||
and self.record_mode != RecordMode.ALL
|
||||
and (self.rewound or self.allow_playback_repeats)
|
||||
)
|
||||
|
||||
def play_response(self, request):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user