1
0
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:
lian
2016-08-19 15:00:10 +08:00
committed by lian
parent 996c67fdb7
commit 5a700d5f00
7 changed files with 60 additions and 37 deletions

View File

@@ -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)