-
-
Save abmohan/2ffbdf33afdf419abea92c572932e69d to your computer and use it in GitHub Desktop.
Test file upload with flask (Python3)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from io import BytesIO | |
def test_file_upload(client): | |
data = { | |
'field': 'value', | |
'file': (BytesIO(b'FILE CONTENT'), 'test.csv') | |
} | |
rv = client.post('/upload', buffered=True, | |
content_type='multipart/form-data', | |
data=data) | |
assert rv.status_code == 200 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment