mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-24 02:21:04 +00:00
Fixes queryset for shelf page json
This commit is contained in:
parent
a1e8d5c7c2
commit
6eb7872598
2 changed files with 11 additions and 1 deletions
|
@ -39,7 +39,7 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel):
|
||||||
@property
|
@property
|
||||||
def collection_queryset(self):
|
def collection_queryset(self):
|
||||||
''' list of books for this shelf, overrides OrderedCollectionMixin '''
|
''' list of books for this shelf, overrides OrderedCollectionMixin '''
|
||||||
return self.books
|
return self.books.all()
|
||||||
|
|
||||||
def get_remote_id(self):
|
def get_remote_id(self):
|
||||||
''' shelf identifier instead of id '''
|
''' shelf identifier instead of id '''
|
||||||
|
|
|
@ -570,6 +570,16 @@ class Views(TestCase):
|
||||||
self.assertEqual(result.status_code, 200)
|
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):
|
def test_is_bookwyrm_request(self):
|
||||||
''' checks if a request came from a bookwyrm instance '''
|
''' checks if a request came from a bookwyrm instance '''
|
||||||
request = self.factory.get('', {'q': 'Test Book'})
|
request = self.factory.get('', {'q': 'Test Book'})
|
||||||
|
|
Loading…
Reference in a new issue