Fixes queryset for shelf page json

This commit is contained in:
Mouse Reeve 2021-01-10 07:54:58 -08:00
parent a1e8d5c7c2
commit 6eb7872598
2 changed files with 11 additions and 1 deletions

View file

@ -39,7 +39,7 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel):
@property
def collection_queryset(self):
''' list of books for this shelf, overrides OrderedCollectionMixin '''
return self.books
return self.books.all()
def get_remote_id(self):
''' shelf identifier instead of id '''

View file

@ -570,6 +570,16 @@ class Views(TestCase):
self.assertEqual(result.status_code, 200)
request = self.factory.get('/?page=1')
request.user = self.local_user
with patch('bookwyrm.views.is_api_request') as is_api:
is_api.return_value = True
result = views.shelf_page(
request, self.local_user.username, shelf.identifier)
self.assertIsInstance(result, ActivitypubResponse)
self.assertEqual(result.status_code, 200)
def test_is_bookwyrm_request(self):
''' checks if a request came from a bookwyrm instance '''
request = self.factory.get('', {'q': 'Test Book'})