Add convert
This commit is contained in:
@@ -320,7 +320,7 @@ class model(dict):
|
||||
from PIL import Image
|
||||
im = Image.open(fname)
|
||||
img_byte_arr = io.BytesIO()
|
||||
im.save(img_byte_arr, format='JPEG', quality=int(os.getenv("NOTIFICATION_SCREENSHOT_JPG_QUALITY", 75)))
|
||||
im.convert('RGB').save(img_byte_arr, format='JPEG', quality=int(os.getenv("NOTIFICATION_SCREENSHOT_JPG_QUALITY", 75)))
|
||||
return img_byte_arr.getvalue()
|
||||
|
||||
# False is not an option for AppRise, must be type None
|
||||
|
||||
@@ -163,6 +163,7 @@ def test_check_notification(client, live_server):
|
||||
|
||||
# Check the attachment was added, and that it is a JPEG from the original PNG
|
||||
notification_submission_object = json.loads(notification_submission)
|
||||
# We actually convert the PNG to JPEG and send it
|
||||
assert notification_submission_object['attachments'][0]['filename'] == 'last-screenshot.jpg'
|
||||
assert len(notification_submission_object['attachments'][0]['base64'])
|
||||
assert notification_submission_object['attachments'][0]['mimetype'] == 'image/jpeg'
|
||||
|
||||
Reference in New Issue
Block a user