mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 07:27:04 +00:00
update set_notice_seen_by_id
This commit is contained in:
@@ -2,7 +2,7 @@ import json
|
||||
from seahub.test_utils import BaseTestCase
|
||||
from seahub.notifications.models import UserNotification
|
||||
|
||||
class InvitationsTest(BaseTestCase):
|
||||
class NotificationsTest(BaseTestCase):
|
||||
def setUp(self):
|
||||
self.endpoint = '/api/v2.1/notifications/'
|
||||
self.username = self.user.username
|
||||
@@ -42,3 +42,19 @@ class InvitationsTest(BaseTestCase):
|
||||
resp = self.client.put(self.endpoint, {}, 'application/x-www-form-urlencoded')
|
||||
self.assertEqual(403, resp.status_code)
|
||||
|
||||
class NotificationTest(BaseTestCase):
|
||||
def setUp(self):
|
||||
self.endpoint = '/api/v2.1/notification/'
|
||||
self.username = self.user.username
|
||||
|
||||
def test_can_unseen_notification_by_id(self):
|
||||
|
||||
notice = UserNotification.objects.add_file_uploaded_msg(self.username, 'test')
|
||||
assert UserNotification.objects.count_unseen_user_notifications(self.username) == 1
|
||||
|
||||
self.login_as(self.user)
|
||||
data = 'notice_id=%d' % notice.id
|
||||
resp = self.client.put(self.endpoint, data, 'application/x-www-form-urlencoded')
|
||||
self.assertEqual(200, resp.status_code)
|
||||
|
||||
assert UserNotification.objects.count_unseen_user_notifications(self.username) == 0
|
||||
|
Reference in New Issue
Block a user