]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
Added tests for Cassette#all_played
authorMax Shytikov <mshytikov@gmail.com>
Mon, 5 May 2014 22:46:03 +0000 (00:46 +0200)
committerMax Shytikov <mshytikov@gmail.com>
Mon, 5 May 2014 22:46:03 +0000 (00:46 +0200)
tests/integration/test_record_mode.py
tests/unit/test_cassettes.py

index c47baad88d0a9f74e10ef61472d902a5919ab285..0e007b36be32a53955517ea7fc270132f13b57f7 100644 (file)
@@ -54,6 +54,9 @@ def test_new_episodes_record_mode(tmpdir):
         # make the same request again
         response = urlopen('http://httpbin.org/').read()
 
+        # all responses have been played
+        assert cass.all_played
+
         # in the "new_episodes" record mode, we can add more requests to
         # a cassette without repurcussions.
         response = urlopen('http://httpbin.org/get').read()
@@ -61,6 +64,9 @@ def test_new_episodes_record_mode(tmpdir):
         # one of the responses has been played
         assert cass.play_count == 1
 
+        # not all responses have been played
+        assert not cass.all_played
+
     with vcr.use_cassette(testfile, record_mode="new_episodes") as cass:
         # the cassette should now have 2 responses
         assert len(cass.responses) == 2
index 1c5b84ca331733cfd9c2866372ee9751dc73e303..20df9509eefbf16b8848ee30009f4afe41f18e1f 100644 (file)
@@ -65,3 +65,17 @@ def test_cassette_cant_read_same_request_twice():
     a.play_response('foo')
     with pytest.raises(UnhandledHTTPRequestError):
         a.play_response('foo')
+
+
+def test_cassette_not_all_played():
+    a = Cassette('test')
+    a.append('foo', 'bar')
+    assert not a.all_played
+
+
+@mock.patch('vcr.cassette.requests_match', _mock_requests_match)
+def test_cassette_all_played():
+    a = Cassette('test')
+    a.append('foo', 'bar')
+    a.play_response('foo')
+    assert a.all_played