forked from mirrors/bookwyrm
Fixes missing f format in preview image string
plus a unit test for it
This commit is contained in:
parent
1be33c97a2
commit
90c74f00c9
2 changed files with 10 additions and 1 deletions
|
@ -415,7 +415,7 @@ def generate_user_preview_image_task(user_id):
|
|||
|
||||
texts = {
|
||||
"text_one": user.display_name,
|
||||
"text_three": "@{user.localname}@{settings.DOMAIN}",
|
||||
"text_three": f"@{user.localname}@{settings.DOMAIN}",
|
||||
}
|
||||
|
||||
if user.avatar:
|
||||
|
|
|
@ -20,6 +20,7 @@ from bookwyrm.preview_images import (
|
|||
|
||||
# pylint: disable=unused-argument
|
||||
# pylint: disable=missing-function-docstring
|
||||
# pylint: disable=consider-using-with
|
||||
class PreviewImages(TestCase):
|
||||
"""every response to a get request, html or json"""
|
||||
|
||||
|
@ -120,3 +121,11 @@ class PreviewImages(TestCase):
|
|||
self.assertEqual(
|
||||
self.local_user.preview_image.height, settings.PREVIEW_IMG_HEIGHT
|
||||
)
|
||||
|
||||
def test_generate_user_preview_images_task(self, *args, **kwargs):
|
||||
"""test task's external calls"""
|
||||
with patch("bookwyrm.preview_images.generate_preview_image") as generate_mock:
|
||||
generate_user_preview_image_task(self.local_user.id)
|
||||
args = generate_mock.call_args.kwargs
|
||||
self.assertEqual(args["texts"]["text_one"], "possum")
|
||||
self.assertEqual(args["texts"]["text_three"], f"@possum@{settings.DOMAIN}")
|
||||
|
|
Loading…
Reference in a new issue