Ejemplo n.º 1
0
    def test_keywords_conversion(self):
        yield self.perform_full_submission_actions()
        yield Delivery().run()

        data = {}
        data['type'] = 'tip'
        data['user'] = yield user.get_user(1, self.dummyReceiver_1['id'],
                                           u'en')
        data['context'] = yield admin.context.get_context(
            1, self.dummyContext['id'], u'en')
        data['notification'] = yield tw(admin.notification.db_get_notification,
                                        1, u'en')
        data['node'] = yield tw(admin.node.db_admin_serialize_node, 1, u'en')

        for tip in self.dummyRTips:
            if tip['receiver_id'] == self.dummyReceiver_1['id']:
                tip_id = tip['id']
                break

        data['tip'], _ = yield rtip.get_rtip(1, self.dummyReceiver_1['id'],
                                             tip_id, u'en')

        data['comments'] = data['tip']['comments']
        data['comment'] = data['comments'][0]

        data['messages'] = data['tip']['messages']
        data['message'] = data['messages'][0]

        files = yield rtip.receiver_get_rfile_list(data['tip']['id'])
        data['file'] = files[0]

        for key in ['tip', 'comment', 'message', 'file']:
            data['type'] = key
            template = ''.join(supported_template_types[key].keyword_list)
            Templating().format_template(template, data)
Ejemplo n.º 2
0
    def test_keywords_conversion(self):
        yield self.perform_full_submission_actions()
        yield Delivery().run()

        data = {}
        data['type'] = 'tip'
        data['user'] = yield user.get_user(1, self.dummyReceiver_1['id'], u'en')
        data['context'] = yield admin.context.get_context(1, self.dummyContext['id'], u'en')
        data['notification'] = yield tw(admin.notification.db_get_notification, 1, u'en')
        data['node'] = yield tw(admin.node.db_admin_serialize_node, 1, u'en')

        for tip in self.dummyRTips:
            if tip['receiver_id'] == self.dummyReceiver_1['id']:
                tip_id = tip['id']
                break

        data['tip'], _ = yield rtip.get_rtip(1, self.dummyReceiver_1['id'], tip_id, u'en')

        data['comments'] = data['tip']['comments']
        data['comment'] = data['comments'][0]

        data['messages'] = data['tip']['messages']
        data['message'] = data['messages'][0]

        files = yield rtip.receiver_get_rfile_list(data['tip']['id'])
        data['file'] = files[0]

        for key in ['tip', 'comment', 'message', 'file']:
            data['type'] = key
            template = ''.join(supported_template_types[key].keyword_list)
            Templating().format_template(template, data)
Ejemplo n.º 3
0
    def test_mail(self, req_args, *args, **kwargs):
        tid = self.request.tid
        user = yield get_user(tid, self.current_user.user_id,
                              self.state.tenant_cache[tid].default_language)

        language = user['language']

        data = {
            'type': 'admin_test',
            'node': (yield tw(db_admin_serialize_node, tid, language)),
            'notification': (yield tw(db_get_notification, tid, language)),
            'user': user,
        }

        subject, body = Templating().get_mail_subject_and_body(data)

        yield self.state.sendmail(tid, user['mail_address'], subject, body)