def createNotification(self, id, action, guid=None): notification = NotificationSubscription(id) notification.action = action self._updateContent(notification) self._getNotificationManager()._setObject(id, notification) acquired_notification = self._getNotificationManager().findChild(id) self.notificationPermissions.setupNotification(acquired_notification) self.updateNotificationSubscriptions(notification) notification = self._getNotificationManager().findChild(id) notification.userRead = True notification.userWrite = True notification.userManage = True if guid: IGlobalIdentifier(notification).guid = guid return notification
# duplicate id as mock_zodb_trigger_c mock_zep_trigger_d = _triggerFactory( str(uuid4()), mock_zodb_trigger_c.id ) # duplicate id as mock_zodb_trigger_c mock_zep_trigger_e = _triggerFactory( str(uuid4()), mock_zodb_trigger_c.id ) # This notification starts subscribed to all three triggers and will # be used in testing the syncronization of removing a trigger and # having notifications update and remove invalid subscriptions. mock_notification_a = NotificationSubscription('mock_a') mock_notification_a.subscriptions = [ mock_zodb_trigger_a._mock_guid, mock_zodb_trigger_b._mock_guid, mock_zodb_trigger_c._mock_guid, ] mock_notification_b = NotificationSubscription('mock_b') mock_notification_b.subscriptions = [ mock_zodb_trigger_a._mock_guid, ] mock_notification_c = NotificationSubscription('mock_c') mock_notification_c.subscriptions = [] class MockNotificationManager(object): """