Adds test for json requests to all books view

This commit is contained in:
Mouse Reeve 2021-12-28 15:04:06 -08:00
parent 14601a0c31
commit 3f8e309680

View file

@ -60,6 +60,18 @@ class ShelfViews(TestCase):
validate_html(result.render())
self.assertEqual(result.status_code, 200)
def test_shelf_page_all_books_json(self, *_):
"""there is no json view here"""
view = views.Shelf.as_view()
request = self.factory.get("")
request.user = self.local_user
with patch("bookwyrm.views.shelf.shelf.is_api_request") as is_api:
is_api.return_value = True
result = view(request, self.local_user.username)
self.assertIsInstance(result, TemplateResponse)
validate_html(result.render())
self.assertEqual(result.status_code, 200)
def test_shelf_page_all_books_anonymous(self, *_):
"""there are so many views, this just makes sure it LOADS"""
view = views.Shelf.as_view()