-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from sigmavirus24/feature/add-allow_playback_…
…repeats-option Add allow_playback_repeats option
- Loading branch information
Showing
6 changed files
with
65 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"http_interactions": [{"response": {"url": "http://httpbin.org/get", "status": {"message": "OK", "code": 200}, "body": {"string": "{\n \"args\": {}, \n \"headers\": {\n \"Accept\": \"*/*\", \n \"Accept-Encoding\": \"gzip, deflate\", \n \"Host\": \"httpbin.org\", \n \"User-Agent\": \"python-requests/2.9.1\"\n }, \n \"origin\": \"96.37.91.79\", \n \"url\": \"http://httpbin.org/get\"\n}\n", "encoding": null}, "headers": {"Access-Control-Allow-Origin": ["*"], "Access-Control-Allow-Credentials": ["true"], "Connection": ["keep-alive"], "Content-Type": ["application/json"], "Date": ["Thu, 07 Apr 2016 13:22:08 GMT"], "Server": ["nginx"], "Content-Length": ["235"]}}, "recorded_at": "2016-04-07T13:22:13", "request": {"uri": "http://httpbin.org/get", "method": "GET", "body": {"string": "", "encoding": "utf-8"}, "headers": {"Accept": ["*/*"], "Connection": ["keep-alive"], "User-Agent": ["python-requests/2.9.1"], "Accept-Encoding": ["gzip, deflate"]}}}], "recorded_with": "betamax/0.5.1"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import betamax | ||
|
||
from tests.integration import helper | ||
|
||
|
||
class TestPlaybackRepeatInteractions(helper.IntegrationHelper): | ||
def test_will_replay_the_same_interaction(self): | ||
self.cassette_created = False | ||
s = self.session | ||
recorder = betamax.Betamax(s) | ||
# NOTE(sigmavirus24): Ensure the cassette is recorded | ||
with recorder.use_cassette('replay_interactions'): | ||
cassette = recorder.current_cassette | ||
r = s.get('http://httpbin.org/get') | ||
assert r.status_code == 200 | ||
assert len(cassette.interactions) == 1 | ||
|
||
with recorder.use_cassette('replay_interactions', | ||
allow_playback_repeats=True): | ||
cassette = recorder.current_cassette | ||
r = s.get('http://httpbin.org/get') | ||
assert r.status_code == 200 | ||
assert len(cassette.interactions) == 1 | ||
r = s.get('http://httpbin.org/get') | ||
assert r.status_code == 200 | ||
assert len(cassette.interactions) == 1 | ||
assert cassette.interactions[0].used is False |