diff --git a/.env.dev.example b/.env.dev.example index 1613321a..1cf8e344 100644 --- a/.env.dev.example +++ b/.env.dev.example @@ -49,7 +49,7 @@ EMAIL_USE_SSL=false # or use_dominant_color_light / use_dominant_color_dark PREVIEW_BG_COLOR=use_dominant_color_light # Change to #FFF if you use use_dominant_color_dark -PREVIEW_TEXT_COLOR=#363636 +PREVIEW_TEXT_COLOR="#363636" PREVIEW_IMG_WIDTH=1200 PREVIEW_IMG_HEIGHT=630 -PREVIEW_DEFAULT_COVER_COLOR=#002549 \ No newline at end of file +PREVIEW_DEFAULT_COVER_COLOR="#002549" \ No newline at end of file diff --git a/.env.prod.example b/.env.prod.example index d8aa2435..646b0258 100644 --- a/.env.prod.example +++ b/.env.prod.example @@ -49,7 +49,7 @@ EMAIL_USE_SSL=false # or use_dominant_color_light / use_dominant_color_dark PREVIEW_BG_COLOR=use_dominant_color_light # Change to #FFF if you use use_dominant_color_dark -PREVIEW_TEXT_COLOR=#363636 +PREVIEW_TEXT_COLOR="#363636" PREVIEW_IMG_WIDTH=1200 PREVIEW_IMG_HEIGHT=630 -PREVIEW_DEFAULT_COVER_COLOR=#002549 \ No newline at end of file +PREVIEW_DEFAULT_COVER_COLOR="#002549" \ No newline at end of file diff --git a/bookwyrm/tests/views/test_edit_user.py b/bookwyrm/tests/views/test_edit_user.py index e3b9d463..af39f005 100644 --- a/bookwyrm/tests/views/test_edit_user.py +++ b/bookwyrm/tests/views/test_edit_user.py @@ -21,25 +21,29 @@ class EditUserViews(TestCase): def setUp(self): """we need basic test data and mocks""" self.factory = RequestFactory() - self.local_user = models.User.objects.create_user( - "mouse@local.com", - "mouse@mouse.mouse", - "password", - local=True, - localname="mouse", - ) - self.rat = models.User.objects.create_user( - "rat@local.com", "rat@rat.rat", "password", local=True, localname="rat" - ) - self.book = models.Edition.objects.create(title="test") - with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"): - models.ShelfBook.objects.create( - book=self.book, - user=self.local_user, - shelf=self.local_user.shelf_set.first(), + with patch("bookwyrm.preview_images.generate_user_preview_image_task.delay"): + self.local_user = models.User.objects.create_user( + "mouse@local.com", + "mouse@mouse.mouse", + "password", + local=True, + localname="mouse", + ) + self.rat = models.User.objects.create_user( + "rat@local.com", "rat@rat.rat", "password", local=True, localname="rat" ) - models.SiteSettings.objects.create() + with patch("bookwyrm.preview_images.generate_edition_preview_image_task.delay"): + self.book = models.Edition.objects.create(title="test") + with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"): + models.ShelfBook.objects.create( + book=self.book, + user=self.local_user, + shelf=self.local_user.shelf_set.first(), + ) + + with patch("bookwyrm.preview_images.generate_site_preview_image_task.delay"): + models.SiteSettings.objects.create() self.anonymous_user = AnonymousUser self.anonymous_user.is_authenticated = False @@ -64,11 +68,12 @@ class EditUserViews(TestCase): request.user = self.local_user self.assertIsNone(self.local_user.name) - with patch( - "bookwyrm.models.activitypub_mixin.broadcast_task.delay" - ) as delay_mock: - view(request) - self.assertEqual(delay_mock.call_count, 1) + with patch("bookwyrm.preview_images.generate_user_preview_image_task.delay"): + with patch( + "bookwyrm.models.activitypub_mixin.broadcast_task.delay" + ) as delay_mock: + view(request) + self.assertEqual(delay_mock.call_count, 1) self.assertEqual(self.local_user.name, "New Name") self.assertEqual(self.local_user.email, "wow@email.com") @@ -88,11 +93,12 @@ class EditUserViews(TestCase): request = self.factory.post("", form.data) request.user = self.local_user - with patch( - "bookwyrm.models.activitypub_mixin.broadcast_task.delay" - ) as delay_mock: - view(request) - self.assertEqual(delay_mock.call_count, 1) + with patch("bookwyrm.preview_images.generate_user_preview_image_task.delay"): + with patch( + "bookwyrm.models.activitypub_mixin.broadcast_task.delay" + ) as delay_mock: + view(request) + self.assertEqual(delay_mock.call_count, 1) self.assertEqual(self.local_user.name, "New Name") self.assertEqual(self.local_user.email, "wow@email.com") self.assertIsNotNone(self.local_user.avatar) diff --git a/bookwyrm/tests/views/test_user.py b/bookwyrm/tests/views/test_user.py index 49f29733..3e7a5108 100644 --- a/bookwyrm/tests/views/test_user.py +++ b/bookwyrm/tests/views/test_user.py @@ -135,4 +135,4 @@ class UserViews(TestCase): with patch("bookwyrm.views.user.is_api_request") as is_api: is_api.return_value = False with self.assertRaises(Http404): - view(request, "rat") \ No newline at end of file + view(request, "rat")