From 2bf254bce7cf47bc29213cabb87af4d969f362f8 Mon Sep 17 00:00:00 2001 From: Joachim Date: Fri, 28 May 2021 21:26:13 +0200 Subject: [PATCH] Update test_preview_images.py --- bookwyrm/tests/test_preview_images.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/bookwyrm/tests/test_preview_images.py b/bookwyrm/tests/test_preview_images.py index 6edf2e791..86ed00287 100644 --- a/bookwyrm/tests/test_preview_images.py +++ b/bookwyrm/tests/test_preview_images.py @@ -20,6 +20,7 @@ from bookwyrm.preview_images import ( import logging + @patch("bookwyrm.emailing.send_email.delay") class PreviewImages(TestCase): """every response to a get request, html or json""" @@ -38,8 +39,10 @@ class PreviewImages(TestCase): local=True, localname="possum", avatar=SimpleUploadedFile( - avatar_file, open(avatar_file, "rb").read(), content_type="image/jpeg" - ) + avatar_file, + open(avatar_file, "rb").read(), + content_type="image/jpeg", + ), ) with patch("bookwyrm.preview_images.generate_edition_preview_image_task.delay"): self.work = models.Work.objects.create(title="Test Work") @@ -63,7 +66,9 @@ class PreviewImages(TestCase): result = generate_preview_image(texts=texts, picture=image_file, rating=5) self.assertIsInstance(result, Image.Image) - self.assertEqual(result.size, (settings.PREVIEW_IMG_WIDTH, settings.PREVIEW_IMG_HEIGHT)) + self.assertEqual( + result.size, (settings.PREVIEW_IMG_WIDTH, settings.PREVIEW_IMG_HEIGHT) + ) def test_site_preview(self, *args, **kwargs): """generate site preview""" @@ -74,7 +79,9 @@ class PreviewImages(TestCase): self.assertIsInstance(site_preview_image, ImageFieldFile) result = Image.open(site_preview_image) - self.assertEqual(result.size, (settings.PREVIEW_IMG_WIDTH, settings.PREVIEW_IMG_HEIGHT)) + self.assertEqual( + result.size, (settings.PREVIEW_IMG_WIDTH, settings.PREVIEW_IMG_HEIGHT) + ) def test_edition_preview(self, *args, **kwargs): """generate user preview""" @@ -85,7 +92,9 @@ class PreviewImages(TestCase): self.assertIsInstance(book_preview_image, ImageFieldFile) result = Image.open(book_preview_image) - self.assertEqual(result.size, (settings.PREVIEW_IMG_WIDTH, settings.PREVIEW_IMG_HEIGHT)) + self.assertEqual( + result.size, (settings.PREVIEW_IMG_WIDTH, settings.PREVIEW_IMG_HEIGHT) + ) def test_user_preview(self, *args, **kwargs): """generate user preview""" @@ -96,4 +105,6 @@ class PreviewImages(TestCase): self.assertIsInstance(user_preview_image, ImageFieldFile) result = Image.open(user_preview_image) - self.assertEqual(result.size, (settings.PREVIEW_IMG_WIDTH, settings.PREVIEW_IMG_HEIGHT)) + self.assertEqual( + result.size, (settings.PREVIEW_IMG_WIDTH, settings.PREVIEW_IMG_HEIGHT) + )