Skip to content

Commit

Permalink
Adapt unit tests to reflect new image_optimize API parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ngandrass committed Jul 18, 2024
1 parent dffb4de commit f2047e9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/fixtures/reference_quiz_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/reference_quiz_single_attempt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/reference_quiz_single_attempt_no_backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 8 additions & 4 deletions tests/test_quiz_archive_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

0 comments on commit f2047e9

Please sign in to comment.