mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-08-09 03:37:54 +02:00
Fix bookmark access restrictions
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from django.contrib.auth.models import User
|
||||
from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
|
||||
@@ -33,3 +34,13 @@ class BookmarkUnarchiveViewTestCase(TestCase, BookmarkFactoryMixin):
|
||||
)
|
||||
|
||||
self.assertRedirects(response, reverse('bookmarks:close'))
|
||||
|
||||
def test_can_only_archive_own_bookmarks(self):
|
||||
other_user = User.objects.create_user('otheruser', 'otheruser@example.com', 'password123')
|
||||
bookmark = self.setup_bookmark(is_archived=True, user=other_user)
|
||||
|
||||
response = self.client.get(reverse('bookmarks:unarchive', args=[bookmark.id]))
|
||||
bookmark.refresh_from_db()
|
||||
|
||||
self.assertEqual(response.status_code, 404)
|
||||
self.assertTrue(bookmark.is_archived)
|
||||
|
Reference in New Issue
Block a user