mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-11 09:45:27 +00:00
Make sure creating books doesn't broadcast in tests
This commit is contained in:
parent
37e29cc735
commit
500394fc52
2 changed files with 8 additions and 7 deletions
|
@ -149,8 +149,8 @@ class BookViews(TestCase):
|
|||
form.data["last_edited_by"] = self.local_user.id
|
||||
request = self.factory.post("", form.data)
|
||||
request.user = self.local_user
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||
view(request)
|
||||
|
||||
view(request)
|
||||
book = models.Edition.objects.get(title="New Title")
|
||||
self.assertEqual(book.parent_work.title, "New Title")
|
||||
|
||||
|
@ -164,8 +164,8 @@ class BookViews(TestCase):
|
|||
form.data["last_edited_by"] = self.local_user.id
|
||||
request = self.factory.post("", form.data)
|
||||
request.user = self.local_user
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||
view(request)
|
||||
|
||||
view(request)
|
||||
book = models.Edition.objects.get(title="New Title")
|
||||
self.assertEqual(book.parent_work, self.work)
|
||||
|
||||
|
@ -179,8 +179,8 @@ class BookViews(TestCase):
|
|||
form.data["last_edited_by"] = self.local_user.id
|
||||
request = self.factory.post("", form.data)
|
||||
request.user = self.local_user
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||
view(request)
|
||||
|
||||
view(request)
|
||||
book = models.Edition.objects.get(title="New Title")
|
||||
self.assertEqual(book.parent_work.title, "New Title")
|
||||
self.assertEqual(book.authors.first().name, "Sappho")
|
||||
|
|
|
@ -209,7 +209,8 @@ class ConfirmEditBook(View):
|
|||
work = models.Work.objects.create(title=form.cleaned_data["title"])
|
||||
work.authors.set(book.authors.all())
|
||||
book.parent_work = work
|
||||
book.save()
|
||||
# we don't tell the world when creating a book
|
||||
book.save(broadcast=False)
|
||||
|
||||
for author_id in request.POST.getlist("remove_authors"):
|
||||
book.authors.remove(author_id)
|
||||
|
|
Loading…
Reference in a new issue