From 4ae0dbde92389badc8f6032fa6b1f6efc4c9b1fb Mon Sep 17 00:00:00 2001 From: mattkatz Date: Thu, 28 Sep 2023 21:50:09 -0400 Subject: [PATCH] add a failing test for rss feeds for shelves Currently can't get the test to succeed - it fails in an unrelated redis error, so pushing this so I can open a draft PR to get advice on a better test. --- bookwyrm/tests/views/test_rss_feed.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/bookwyrm/tests/views/test_rss_feed.py b/bookwyrm/tests/views/test_rss_feed.py index cfbec3360..2b643cbdd 100644 --- a/bookwyrm/tests/views/test_rss_feed.py +++ b/bookwyrm/tests/views/test_rss_feed.py @@ -127,3 +127,26 @@ class RssFeedView(TestCase): self.assertEqual(result.status_code, 200) self.assertIn(b"a sickening sense", result.content) + + def test_rss_shelf(self, *_): + """load the rss feed of a shelf""" + with patch("bookwyrm.models.activitypub_mixin.broadcast_task.apply_async"): + # make the shelf + self.shelf = models.Shelf.objects.create( + name="Test Shelf", identifier="test-shelf", user=self.local_user + ) + # put the shelf on the book + models.ShelfBook.objects.create( + book=self.book, + shelf=self.shelf, + user=self.local_user, + ) + models.SiteSettings.objects.create() + view = rss_feed.RssShelfFeed() + request = self.factory.get("/user/books/test-shelf/rss") + request.user = self.local_user + result = view( + request, username=self.local_user.username, shelf_identifier="test-shelf" + ) + self.assertEqual(result.status_code, 200) + self.assertIn(b"Example Edition", result.content)