def test_handles_binary_responses(body, content_type):
r = Response(body=body, headers={'Content-Type': content_type})
serialized = r.to_dict(BINARY_TYPES)
# A binary response should always result in the
# response being base64 encoded.
assert serialized['isBase64Encoded']
assert isinstance(serialized['body'], six.string_types)
assert isinstance(base64.b64decode(serialized['body']), bytes)
评论列表
文章目录