This commit is contained in:
Mouse Reeve 2022-07-07 11:37:34 -07:00
parent 634ed50044
commit 1a082b5ee8
2 changed files with 3 additions and 1 deletions

View file

@ -55,5 +55,6 @@ jobs:
EMAIL_HOST_PASSWORD: "" EMAIL_HOST_PASSWORD: ""
EMAIL_USE_TLS: true EMAIL_USE_TLS: true
ENABLE_PREVIEW_IMAGES: false ENABLE_PREVIEW_IMAGES: false
ENABLE_THUMBNAIL_GENERATION: true
run: | run: |
pytest -n 3 pytest -n 3

View file

@ -103,15 +103,16 @@ class Book(TestCase):
def test_thumbnail_fields(self): def test_thumbnail_fields(self):
"""Just hit them""" """Just hit them"""
settings.ENABLE_THUMBNAIL_GENERATION = True
image_file = pathlib.Path(__file__).parent.joinpath( image_file = pathlib.Path(__file__).parent.joinpath(
"../../static/images/default_avi.jpg" "../../static/images/default_avi.jpg"
) )
image = Image.open(image_file) image = Image.open(image_file)
output = BytesIO() output = BytesIO()
image.save(output, format=image.format) image.save(output, format=image.format)
book = models.Edition.objects.create(title="hello") book = models.Edition.objects.create(title="hello")
book.cover.save("test.jpg", ContentFile(output.getvalue())) book.cover.save("test.jpg", ContentFile(output.getvalue()))
self.assertIsNotNone(book.cover_bw_book_xsmall_webp.url) self.assertIsNotNone(book.cover_bw_book_xsmall_webp.url)
self.assertIsNotNone(book.cover_bw_book_xsmall_jpg.url) self.assertIsNotNone(book.cover_bw_book_xsmall_jpg.url)
self.assertIsNotNone(book.cover_bw_book_small_webp.url) self.assertIsNotNone(book.cover_bw_book_small_webp.url)