mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 17:15:35 +00:00
Add Exception when JSON Serializing Binary Data
Since I can't think of a good way to deal with this, let's just give a nice error message to point people in the right direction. Closes #51
This commit is contained in:
14
tests/unit/test_json_serializer.py
Normal file
14
tests/unit/test_json_serializer.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import pytest
|
||||
from vcr.serializers.jsonserializer import serialize
|
||||
from vcr.request import Request
|
||||
|
||||
|
||||
def test_serialize_binary():
|
||||
request = Request('http','localhost',80,'GET','/',{},{})
|
||||
cassette = {'requests': [request], 'responses': [{'body':b'\x8c'}]}
|
||||
|
||||
with pytest.raises(Exception) as e:
|
||||
serialize(cassette)
|
||||
assert e.message == "Error serializing cassette to JSON. Does this \
|
||||
HTTP interaction contain binary data? If so, use a different \
|
||||
serializer (like the yaml serializer) for this request"
|
||||
Reference in New Issue
Block a user