Compare commits

..

1 Commits

Author SHA1 Message Date
Frédéric Péters c933433a24 misc: autoconvert HEIC files (#88586)
gitea/wcs/pipeline/head There was a failure building this commit Details
2024-03-25 10:03:31 +01:00
1 changed files with 20 additions and 0 deletions

View File

@ -592,3 +592,23 @@ def test_file_download_url_on_wrong_field(pub):
resp = resp.form.submit('submit').follow() # -> submit
formdata = formdef.data_class().select()[0]
app.get(formdata.get_url() + 'files/1/', status=404)
def test_file_auto_convert_heic(pub):
FormDef.wipe()
formdef = FormDef()
formdef.name = 'test'
formdef.fields = [fields.FileField(id='0', label='field label')]
formdef.store()
formdef.data_class().wipe()
with open(os.path.join(os.path.dirname(__file__), '..', 'image.heic'), 'rb') as fd:
upload = Upload('image.heic', fd.read(), 'image/heic')
resp = get_app(pub).get('/test/')
resp.forms[0]['f0$file'] = upload
resp = resp.forms[0].submit('submit') # -> validation
resp = resp.forms[0].submit('submit') # -> submit
resp = resp.follow()
assert resp.click('image.jpeg').follow().content_type == 'image/jpeg'
assert b'JFIF' in resp.click('image.jpeg').follow().body