示例#1
0
def deserialize(cassette_string, serializer):
    try:
        data = serializer.deserialize(cassette_string)
    # Old cassettes used to use yaml object thingy so I have to
    # check for some fairly stupid exceptions here
    except (ImportError, yaml.constructor.ConstructorError):
        _warn_about_old_cassette_format()
    if _looks_like_an_old_cassette(data):
        _warn_about_old_cassette_format()

    requests = [Request._from_dict(r["request"]) for r in data["interactions"]]
    responses = [
        compat.convert_to_bytes(r["response"]) for r in data["interactions"]
    ]
    return requests, responses
示例#2
0
def deserialize(cassette_string, serializer):
    try:
        data = serializer.deserialize(cassette_string)
    # Old cassettes used to use yaml object thingy so I have to
    # check for some fairly stupid exceptions here
    except (ImportError, yaml.constructor.ConstructorError):
        _warn_about_old_cassette_format()
    if _looks_like_an_old_cassette(data):
        _warn_about_old_cassette_format()

    requests = [Request._from_dict(r['request']) for r in data['interactions']]
    responses = [
        compat.convert_to_bytes(r['response']) for r in data['interactions']
    ]
    return requests, responses
示例#3
0
def test_deserialize_no_body_string():
    data = {"body": {"string": None}}
    output = compat.convert_to_bytes(data)
    assert data == output
示例#4
0
def test_deserialize_no_body_string():
    data = {'body': {'string': None}}
    output = compat.convert_to_bytes(data)
    assert data == output
示例#5
0
def test_deserialize_no_body_string():
    data = {'body': {'string': None}}
    output = compat.convert_to_bytes(data)
    assert data == output