mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-08 02:10:24 +00:00
update set_notices_seen
This commit is contained in:
@@ -9,9 +9,9 @@ class InvitationsTest(BaseTestCase):
|
||||
|
||||
def test_can_get_unseen_count(self):
|
||||
|
||||
self.login_as(self.user)
|
||||
|
||||
UserNotification.objects.add_file_uploaded_msg(self.username, 'test')
|
||||
|
||||
self.login_as(self.user)
|
||||
resp = self.client.get(self.endpoint)
|
||||
self.assertEqual(200, resp.status_code)
|
||||
|
||||
@@ -22,3 +22,23 @@ class InvitationsTest(BaseTestCase):
|
||||
|
||||
resp = self.client.get(self.endpoint)
|
||||
self.assertEqual(403, resp.status_code)
|
||||
|
||||
def test_can_unseen_all_notifications(self):
|
||||
|
||||
UserNotification.objects.add_file_uploaded_msg(self.username, 'test')
|
||||
assert UserNotification.objects.count_unseen_user_notifications(self.username) == 1
|
||||
|
||||
self.login_as(self.user)
|
||||
resp = self.client.put(self.endpoint, {}, 'application/x-www-form-urlencoded')
|
||||
self.assertEqual(200, resp.status_code)
|
||||
|
||||
assert UserNotification.objects.count_unseen_user_notifications(self.username) == 0
|
||||
|
||||
def test_unseen_notifications_with_invalid_user_permission(self):
|
||||
|
||||
UserNotification.objects.add_file_uploaded_msg(self.username, 'test')
|
||||
assert UserNotification.objects.count_unseen_user_notifications(self.username) == 1
|
||||
|
||||
resp = self.client.put(self.endpoint, {}, 'application/x-www-form-urlencoded')
|
||||
self.assertEqual(403, resp.status_code)
|
||||
|
||||
|
Reference in New Issue
Block a user