Пример #1
0
 def beforeTearDown(self):
     _notif = self.portal.portal_notification
     _notif.config.clear()
     _notif.config.update(self._original_config)
     _notif.config.update(self._original_config)
     self.portal.manage_delObjects(['notifol'])
     divert_notifications(False)
     transaction.commit()
Пример #2
0
 def beforeTearDown(self):
     notif_tool = self.portal.getNotificationTool()
     restore_all()
     for args in self._subscriptions_to_remove:
         notif_tool.remove_account_subscription(*args)
     self.portal.manage_delObjects(['fol1', 'fol2'])
     notif_tool.config.update(self._notif_config)
     divert_notifications(False)
     transaction.commit()
Пример #3
0
    def beforeTearDown(self):
        notif_tool = self.portal.getNotificationTool()
        notif_tool.config['enable_instant'] = False
        notif_tool.config['enable_weekly'] = False
        notif_tool.remove_account_subscription('contributor',
                                               'tforum', 'instant', 'en')
        notif_tool.remove_account_subscription('contributor',
                                               'tforum', 'weekly', 'en')
        self.portal.manage_delObjects(['tforum'])
        transaction.commit()

        divert_notifications(False)
Пример #4
0
 def afterSetUp(self):
     self._notifications = []
     divert_notifications(True, save_to=self._notifications)
     self.notif = self.portal.portal_notification
     self._original_config = dict(self.notif.config)
     self.notif.config['enable_instant'] = True
     self.notif.config['enable_daily'] = True
     self.notif.config['enable_weekly'] = True
     self.notif.config['enable_monthly'] = True
     addNyFolder(self.portal, 'notifol', contributor='contributor', submitted=1)
     addNyDocument(self.portal.notifol, id='notidoc',
         title='Notifying document', submitted=1, contributor='contributor')
Пример #5
0
    def afterSetUp(self):
        self._notifications = []
        divert_notifications(True, self._notifications)

        addNyForum(self.portal, id='tforum', title='My Forum')
        tforum = self.portal['tforum']
        addNyForumTopic(tforum, id='ttopic', title='My Topic')
        addNyForumMessage(tforum['ttopic'], id='tmessage', title='My Message')
        notif_tool = self.portal.getNotificationTool()
        notif_tool.config['enable_instant'] = True
        notif_tool.config['enable_weekly'] = True
        notif_tool.add_account_subscription('contributor',
                                            'tforum', 'instant', 'en')
        notif_tool.add_account_subscription('contributor',
                                            'tforum', 'weekly', 'en')
        transaction.commit()
Пример #6
0
    def afterSetUp(self):
        notif_tool = self.portal.getNotificationTool()
        self._notif_config = dict(notif_tool.config)
        self._notifications = []
        self._subscriptions_to_remove = []
        divert_notifications(True, save_to=self._notifications)
        addNyFolder(self.portal, 'fol1', contributor='contributor')
        addNyFolder(self.portal, 'fol2', contributor='contributor')

        self.object_timestamps = []
        def testing_list_modified_objects(site, when_start, when_end):
            for ob_path, modif_datetime in self.object_timestamps:
                if when_start < modif_datetime < when_end:
                    yield site.unrestrictedTraverse(ob_path)

        replace(NotificationTool_module,
                'list_modified_objects',
                testing_list_modified_objects)

        def testing_get_template(self, template_name):
            def single_tmpl(ob, person, portal, **kwargs):
                return {'subject': 'notifications',
                        'body_text': 'instant [%s] %s' %
                            (path_in_site(ob), portal.title_or_id())}

            def group_tmpl(portal, objs, **kwargs):
                keyer = lambda item: path_in_site(item['ob'])
                sorted_items = sorted(objs, key=keyer)
                items_str = ''.join('[%s]' % path_in_site(item['ob']) for
                                    item in sorted_items)
                body = '%s %s %s' % (template_name, items_str,
                                     portal.title_or_id())
                return {'subject': 'notifications', 'body_text': body}

            if template_name == 'instant':
                return single_tmpl
            else:
                return group_tmpl

        replace(NotificationTool, '_get_template', testing_get_template)
        transaction.commit()
Пример #7
0
 def beforeTearDown(self):
     self.portal.manage_delObjects(['notifol'])
     self.notif.config.clear()
     self.notif.config.update(self._original_config)
     divert_notifications(False)