Add filter for shared state (#531)

* Add shared filter to bookmark search model

* Add shared filter UI

* Implement shared filter

* Add API test

* Use radio buttons

* Rename shared parameter

* Improve radio button CSS
This commit is contained in:
Sascha Ißbrücker
2023-09-10 23:14:07 +03:00
committed by GitHub
parent b7ddee2d93
commit ffcc40b227
14 changed files with 168 additions and 24 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_shared(self):
self.authenticate()
unshared_bookmarks = self.setup_numbered_bookmarks(5)
shared_bookmarks = self.setup_numbered_bookmarks(5, shared=True)
# Filter off
response = self.get(reverse('bookmarks:bookmark-list'), expected_status_code=status.HTTP_200_OK)
self.assertBookmarkListEqual(response.data['results'], unshared_bookmarks + shared_bookmarks)
# Filter shared
response = self.get(reverse('bookmarks:bookmark-list') + '?shared=shared',
expected_status_code=status.HTTP_200_OK)
self.assertBookmarkListEqual(response.data['results'], shared_bookmarks)
# Filter unshared
response = self.get(reverse('bookmarks:bookmark-list') + '?shared=unshared',
expected_status_code=status.HTTP_200_OK)
self.assertBookmarkListEqual(response.data['results'], unshared_bookmarks)
def test_list_bookmarks_should_respect_sort(self):
self.authenticate()
bookmarks = self.setup_numbered_bookmarks(5)