mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-11 01:53:01 +00:00
Compare commits
2 Commits
fix-allow-
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca4b1e19c2 | ||
|
|
8d47ca10d0 |
@@ -3,7 +3,7 @@
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.14.6
|
||||
rev: v0.14.8
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: ["--output-format=full"]
|
||||
|
||||
@@ -310,13 +310,3 @@ 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,12 +253,7 @@ 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 or self.allow_playback_repeats)
|
||||
)
|
||||
return request and request in self and self.record_mode != RecordMode.ALL and self.rewound
|
||||
|
||||
def play_response(self, request):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user