From f2047e93ee54c19b8344909b025a13b2aa5d5733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Gandra=C3=9F?= Date: Thu, 18 Jul 2024 14:57:26 +0200 Subject: [PATCH] Adapt unit tests to reflect new image_optimize API parameters --- tests/fixtures/reference_quiz_full.py | 2 +- tests/fixtures/reference_quiz_single_attempt.py | 2 +- .../reference_quiz_single_attempt_no_backups.py | 2 +- tests/test_quiz_archive_job.py | 12 ++++++++---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/fixtures/reference_quiz_full.py b/tests/fixtures/reference_quiz_full.py index 553fde7..65194b3 100644 --- a/tests/fixtures/reference_quiz_full.py +++ b/tests/fixtures/reference_quiz_full.py @@ -49,7 +49,7 @@ "paper_format": "A4", "keep_html_files": True, "filename_pattern": "attempt-${attemptid}-${username}_${date}-${time}", - "image_resize": False, + "image_optimize": False, }, "task_moodle_backups": [ { diff --git a/tests/fixtures/reference_quiz_single_attempt.py b/tests/fixtures/reference_quiz_single_attempt.py index 2a11273..be8609c 100644 --- a/tests/fixtures/reference_quiz_single_attempt.py +++ b/tests/fixtures/reference_quiz_single_attempt.py @@ -41,7 +41,7 @@ "paper_format": "A4", "keep_html_files": False, "filename_pattern": "attempt-${attemptid}-${username}_${date}-${time}", - "image_resize": False, + "image_optimize": False, }, "task_moodle_backups": [ { diff --git a/tests/fixtures/reference_quiz_single_attempt_no_backups.py b/tests/fixtures/reference_quiz_single_attempt_no_backups.py index 7dcafe1..49c679f 100644 --- a/tests/fixtures/reference_quiz_single_attempt_no_backups.py +++ b/tests/fixtures/reference_quiz_single_attempt_no_backups.py @@ -41,7 +41,7 @@ "paper_format": "A4", "keep_html_files": False, "filename_pattern": "attempt-${attemptid}-${username}_${date}-${time}", - "image_resize": False, + "image_optimize": False, }, "task_moodle_backups": False, "archive_filename": "quiz-archive-QA-REF-9-Reference Quiz (standard question types)-12" diff --git a/tests/test_quiz_archive_job.py b/tests/test_quiz_archive_job.py index 529c321..4c848be 100644 --- a/tests/test_quiz_archive_job.py +++ b/tests/test_quiz_archive_job.py @@ -286,9 +286,10 @@ def test_archive_attempts_image_resize(self, client, caplog) -> None: # Create job and process it jobjson = fixtures.reference_quiz_single_attempt_no_backups.ARCHIVE_API_REQUEST.copy() - jobjson['task_archive_quiz_attempts']['image_resize'] = { - 'width': 256, - 'height': 256 + jobjson['task_archive_quiz_attempts']['image_optimize'] = { + 'width': 64, + 'height': 64, + 'quality': 85 } jobjson['task_archive_quiz_attempts']['keep_html_files'] = False r = client.post('/archive', json=jobjson) @@ -307,4 +308,7 @@ def test_archive_attempts_image_resize(self, client, caplog) -> None: break # Ensure that the image resize task was executed - assert '-> Resizing image on page' in caplog.text + assert '-> Resizing image' in caplog.text + assert '-> Replacing image' in caplog.text + assert '-> Compressing PDF content streams on page' in caplog.text +