I\'m using Flask-Testing for my Flask integration tests. I\'ve got a form that has a file upload for a logo that I\'m trying to write tests for but I keep getting an error sayin
You need two things:
1.) content_type='multipart/form-data'
in your .post()
2.) in your data=
pass in file=(BytesIO(b'my file contents'), "file_name.jpg")
A full example:
data = dict(
file=(BytesIO(b'my file contents'), "work_order.123"),
)
response = app.post(url_for('items.save'), content_type='multipart/form-data', data=data)