1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-02 07:27:04 +00:00

update get unseen notifications count

This commit is contained in:
lian
2016-08-19 12:00:05 +08:00
committed by lian
parent b4599bf6b0
commit 8d62d3786e
6 changed files with 56 additions and 19 deletions

View File

@@ -0,0 +1,24 @@
import json
from seahub.test_utils import BaseTestCase
from seahub.notifications.models import UserNotification
class InvitationsTest(BaseTestCase):
def setUp(self):
self.endpoint = '/api/v2.1/notifications/'
self.username = self.user.username
def test_can_get_unseen_count(self):
self.login_as(self.user)
UserNotification.objects.add_file_uploaded_msg(self.username, 'test')
resp = self.client.get(self.endpoint)
self.assertEqual(200, resp.status_code)
json_resp = json.loads(resp.content)
assert json_resp['unseen_count'] == 1
def test_get_with_invalid_user_permission(self):
resp = self.client.get(self.endpoint)
self.assertEqual(403, resp.status_code)