def test_upload(client):
# Upload a simple file
file_content = b"This is some test content."
r = client.post(
'/upload',
data={
'file': (BytesIO(file_content), 'example.txt')
}
)
assert r.status_code == 200
# The app should return the public cloud storage URL for the uploaded
# file. Download and verify it.
cloud_storage_url = r.data.decode('utf-8')
r = requests.get(cloud_storage_url)
assert r.text.encode('utf-8') == file_content
评论列表
文章目录