forked from mirrors/bookwyrm
Adds saved list view test
This commit is contained in:
parent
f7c8a550cf
commit
b890e93533
2 changed files with 16 additions and 15 deletions
|
@ -49,8 +49,6 @@ class Activitystreams(TestCase):
|
|||
|
||||
def test_populate_streams(self, *_):
|
||||
"""make sure the function on the redis manager gets called"""
|
||||
with patch(
|
||||
"bookwyrm.lists_stream.populate_lists_task.delay"
|
||||
) as list_mock:
|
||||
with patch("bookwyrm.lists_stream.populate_lists_task.delay") as list_mock:
|
||||
populate_lists_streams()
|
||||
self.assertEqual(list_mock.call_count, 2) # 2 users
|
||||
|
|
|
@ -551,12 +551,7 @@ class ListActionViews(TestCase):
|
|||
)
|
||||
self.assertTrue(self.list.listitem_set.exists())
|
||||
|
||||
request = self.factory.post(
|
||||
"",
|
||||
{
|
||||
"item": item.id,
|
||||
},
|
||||
)
|
||||
request = self.factory.post("", {"item": item.id})
|
||||
request.user = self.local_user
|
||||
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.apply_async"):
|
||||
|
@ -570,14 +565,22 @@ class ListActionViews(TestCase):
|
|||
book_list=self.list, user=self.local_user, book=self.book, order=1
|
||||
)
|
||||
self.assertTrue(self.list.listitem_set.exists())
|
||||
request = self.factory.post(
|
||||
"",
|
||||
{
|
||||
"item": item.id,
|
||||
},
|
||||
)
|
||||
request = self.factory.post("", {"item": item.id})
|
||||
request.user = self.rat
|
||||
|
||||
with self.assertRaises(PermissionDenied):
|
||||
views.list.remove_book(request, self.list.id)
|
||||
self.assertTrue(self.list.listitem_set.exists())
|
||||
|
||||
def test_save_unsave_list(self):
|
||||
"""bookmark a list"""
|
||||
self.assertFalse(self.local_user.saved_lists.exists())
|
||||
request = self.factory.post("")
|
||||
request.user = self.local_user
|
||||
views.save_list(request, self.list.id)
|
||||
self.local_user.refresh_from_db()
|
||||
self.assertEqual(self.local_user.saved_lists.first(), self.list)
|
||||
|
||||
views.unsave_list(request, self.list.id)
|
||||
self.local_user.refresh_from_db()
|
||||
self.assertFalse(self.local_user.saved_lists.exists())
|
||||
|
|
Loading…
Reference in a new issue