From d10c7f6affa31f7c2019b5b77d30c58ce59c15ce Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Tue, 22 Nov 2022 17:53:34 +0100 Subject: [PATCH] Fix test --- changedetectionio/tests/test_notification.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/changedetectionio/tests/test_notification.py b/changedetectionio/tests/test_notification.py index b71e5470..e4999962 100644 --- a/changedetectionio/tests/test_notification.py +++ b/changedetectionio/tests/test_notification.py @@ -71,13 +71,18 @@ def test_check_notification(client, live_server): time.sleep(3) # We write the PNG to disk, but a JPEG should appear in the notification - testimage_png = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=' # Write the last screenshot png + testimage_png = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=' + # This one is created when we save the screenshot from the webdriver/playwright session (converted from PNG) + testimage_jpg = '/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/wAALCAABAAEBAREA/8QAFAABAAAAAAAAAAAAAAAAAAAACf/EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAD8AKp//2Q==' + uuid = extract_UUID_from_client(client) datastore = 'test-datastore' with open(os.path.join(datastore, str(uuid), 'last-screenshot.png'), 'wb') as f: f.write(base64.b64decode(testimage_png)) + with open(os.path.join(datastore, str(uuid), 'last-screenshot.jpg'), 'wb') as f: + f.write(base64.b64decode(testimage_jpg)) # Goto the edit page, add our ignore text # Add our URL to the import page @@ -128,8 +133,6 @@ def test_check_notification(client, live_server): time.sleep(3) set_modified_response() - notification_submission = None - # Trigger a check client.get(url_for("form_watch_checknow"), follow_redirects=True) time.sleep(3)