Add filter for unread state (#535)

This commit is contained in:
Sascha Ißbrücker
2023-09-16 10:39:27 +02:00
committed by GitHub
parent 28acf3299c
commit 3e36f90b38
13 changed files with 149 additions and 31 deletions

View File

@@ -70,6 +70,25 @@ class BookmarksApiTestCase(LinkdingApiTestCase, BookmarkFactoryMixin):
expected_status_code=status.HTTP_200_OK)
self.assertBookmarkListEqual(response.data['results'], bookmarks)
def test_list_bookmarks_filter_unread(self):
self.authenticate()
unread_bookmarks = self.setup_numbered_bookmarks(5, unread=True)
read_bookmarks = self.setup_numbered_bookmarks(5, unread=False)
# Filter off
response = self.get(reverse('bookmarks:bookmark-list'), expected_status_code=status.HTTP_200_OK)
self.assertBookmarkListEqual(response.data['results'], unread_bookmarks + read_bookmarks)
# Filter shared
response = self.get(reverse('bookmarks:bookmark-list') + '?unread=yes',
expected_status_code=status.HTTP_200_OK)
self.assertBookmarkListEqual(response.data['results'], unread_bookmarks)
# Filter unshared
response = self.get(reverse('bookmarks:bookmark-list') + '?unread=no',
expected_status_code=status.HTTP_200_OK)
self.assertBookmarkListEqual(response.data['results'], read_bookmarks)
def test_list_bookmarks_filter_shared(self):
self.authenticate()
unshared_bookmarks = self.setup_numbered_bookmarks(5)