1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 01:03:24 +00:00

Nicer error when cassette doesn't contain request

Raise UnhandledHTTPRequestError.
Show name of cassette and request.
This commit is contained in:
Marc Abramowitz
2013-12-19 15:41:04 -08:00
parent 624212ef15
commit a6806f2f99
2 changed files with 15 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
import pytest
import yaml
import mock
from vcr.cassette import Cassette
from vcr.cassette import Cassette, UnhandledHTTPRequestError
def test_cassette_load(tmpdir):
@@ -53,7 +53,7 @@ def test_cassette_responses_of():
@mock.patch('vcr.cassette.requests_match', _mock_requests_match)
def test_cassette_get_missing_response():
a = Cassette('test')
with pytest.raises(KeyError):
with pytest.raises(UnhandledHTTPRequestError):
a.responses_of('foo')
@mock.patch('vcr.cassette.requests_match', _mock_requests_match)
@@ -61,5 +61,5 @@ def test_cassette_cant_read_same_request_twice():
a = Cassette('test')
a.append('foo','bar')
a.play_response('foo')
with pytest.raises(KeyError):
with pytest.raises(UnhandledHTTPRequestError):
a.play_response('foo')