This commit is contained in:
Joachim
2021-05-26 23:57:29 +02:00
parent f848dcd756
commit 2ea1cd8319
69 changed files with 1370 additions and 1105 deletions

View File

@ -1,6 +1,7 @@
""" testing models """
from django.test import TestCase
from django.core.exceptions import ValidationError
from unittest.mock import patch
from bookwyrm import models
@ -10,15 +11,16 @@ class ReadThrough(TestCase):
def setUp(self):
"""look, a shelf"""
self.user = models.User.objects.create_user(
"mouse", "mouse@mouse.mouse", "mouseword", local=True, localname="mouse"
)
with patch("bookwyrm.preview_images.generate_user_preview_image_task.delay"):
self.user = models.User.objects.create_user(
"mouse", "mouse@mouse.mouse", "mouseword", local=True, localname="mouse"
)
self.work = models.Work.objects.create(title="Example Work")
self.edition = models.Edition.objects.create(
title="Example Edition", parent_work=self.work
)
with patch("bookwyrm.preview_images.generate_edition_preview_image_task.delay"):
self.work = models.Work.objects.create(title="Example Work")
self.edition = models.Edition.objects.create(
title="Example Edition", parent_work=self.work
)
self.readthrough = models.ReadThrough.objects.create(
user=self.user, book=self.edition