Esempio n. 1
0
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 \
Esempio n. 2
0
def test_serialize_binary():
    request = Request(method="GET",
                      uri="http://localhost/",
                      body="",
                      headers={})
    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")
Esempio n. 3
0
def test_serialize_binary():
    request = Request(
        method='GET',
        uri='http://localhost/',
        body='',
        headers={},
    )
    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 \
Esempio n. 4
0
def test_serialize_constructs_UnicodeDecodeError(mock_dumps):
    with pytest.raises(UnicodeDecodeError):
        jsonserializer.serialize({})
Esempio n. 5
0
def test_serialize_constructs_UnicodeDecodeError(mock_dumps):
    with pytest.raises(UnicodeDecodeError):
        jsonserializer.serialize({})
Esempio n. 6
0
 def serialize(cassette_dict):
     cassette_dict = JSONSerializer.fix_dict_encoding(cassette_dict)
     return jsonserializer.serialize(cassette_dict)
Esempio n. 7
0
 def serialize(cassette_dict):
     cassette_dict = JSONSerializer.fix_dict_encoding(cassette_dict)
     return jsonserializer.serialize(cassette_dict)