Make notification lookup faster and fix repo pagination on Postgres

This commit is contained in:
Joseph Schorr 2016-03-30 14:46:31 -04:00
parent 2c7aae10a9
commit 42e934d84f
4 changed files with 48 additions and 32 deletions

View file

@ -314,11 +314,30 @@ class TestUserNotification(ApiTestCase):
assert json['notifications']
assert not json['notifications'][0]['dismissed']
notification = json['notifications'][0]
pjson = self.putJsonResponse(UserNotification, params=dict(uuid=notification['id']),
data=dict(dismissed=True))
self.assertEquals(True, pjson['dismissed'])
def test_org_notifications(self):
# Create a notification on the organization.
org = model.user.get_user_or_org(ORGANIZATION)
model.notification.create_notification('test_notification', org, {'org': 'notification'})
# Ensure it is visible to the org admin.
self.login(ADMIN_ACCESS_USER)
json = self.getJsonResponse(UserNotificationList)
notification = json['notifications'][0]
self.assertEquals(notification['kind'], 'test_notification')
self.assertEquals(notification['metadata'], {'org': 'notification'})
# Ensure it is not visible to an org member.
self.login(READ_ACCESS_USER)
json = self.getJsonResponse(UserNotificationList)
self.assertEquals(0, len(json['notifications']))
class TestGetUserPrivateAllowed(ApiTestCase):
def test_nonallowed(self):