def receiver_RW_comments(self): self.commentCreation['content'] = unicode("Comment N1 by R1") yield rtip.create_comment_receiver( self.receiver1_desc['id'], self.rtip1_id, self.commentCreation) cl = yield rtip.get_comment_list_receiver( self.receiver1_desc['id'], self.rtip1_id) self.assertEqual(len(cl), 1) self.commentCreation['content'] = unicode("Comment N2 by R2") yield rtip.create_comment_receiver( self.receiver2_desc['id'], self.rtip2_id, self.commentCreation) cl = yield rtip.get_comment_list_receiver( self.receiver2_desc['id'], self.rtip2_id) self.assertEqual(len(cl), 2)
def receiver1_see_system_comments(self): cl = yield rtip.get_comment_list_receiver(self.receiver1_desc['id'], self.rtip1_id) self.assertEqual(len(cl), 5) self.assertEqual(cl[0]['type'], u'receiver') self.assertEqual(cl[1]['type'], u'receiver') self.assertEqual(cl[2]['type'], u'whistleblower') self.assertEqual(cl[3]['type'], u'system') self.assertEqual(cl[3]['system_content']['receiver_name'], self.receiver2_desc['name']) self.assertEqual(cl[4]['type'],u'system')
def receiver1_see_system_comments(self): cl = yield rtip.get_comment_list_receiver(self.receiver1_desc['id'], self.rtip1_id) self.assertEqual(len(cl), 5) self.assertEqual(cl[0]['type'], models.Comment._types[0]) # Receiver (Rcvr1) self.assertEqual(cl[1]['type'], models.Comment._types[0]) # Receiver (Rcvr2) self.assertEqual(cl[2]['type'], models.Comment._types[1]) # Wb self.assertEqual(cl[3]['type'], models.Comment._types[2]) # System (date extension) self.assertEqual(cl[3]['system_content']['receiver_name'], self.receiver2_desc['name']) # self.assertTrue(cl[3]['system_content'].has_key('now')) self.assertEqual(cl[4]['type'], models.Comment._types[2]) # System
def postpone_comment_content_check(self): """ 'type': "1", # the first kind of structured system_comments 'receiver_name': rtip.receiver.name, 'now' : datetime_now(), 'expire_on' : datetime_to_ISO8601(rtip.internaltip.expiration_date) """ cl = yield rtip.get_comment_list_receiver(self.receiver1_desc['id'], self.rtip1_id) self.assertEqual(cl[3]['type'], u'system') sys_comm = cl[3] self.assertEqual(sys_comm['system_content']['receiver_name'], self.receiver2_desc['name']) self.assertEqual(sys_comm['system_content']['type'], u"1") new_expire = sys_comm['system_content']['expire_on']
def postpone_comment_content_check(self): """ 'type': "1", # the first kind of structured system_comments 'receiver_name': rtip.receiver.name, 'now' : datetime_now(), 'expire_on' : datetime_to_ISO8601(rtip.internaltip.expiration_date) """ cl = yield rtip.get_comment_list_receiver(self.receiver1_desc['id'], self.rtip1_id) self.assertEqual(cl[3]['type'], models.Comment._types[2]) # System (date extension) sys_comm = cl[3] self.assertEqual(sys_comm['system_content']['receiver_name'], self.receiver2_desc['name']) # self.assertTrue(sys_comm['system_content'].has_key('now')) self.assertEqual(sys_comm['system_content']['type'], u"1") new_expire = sys_comm['system_content']['expire_on']
def test_keywords_conversion(self): yield self.perform_full_submission_actions() yield DeliverySchedule().operation() data = {} data['type'] = 'tip' data['receiver'] = yield admin.receiver.get_receiver(self.dummyReceiver_1['id'], 'en') data['context'] = yield admin.context.get_context(self.dummyContext['id'], 'en') data['notification'] = yield admin.notification.get_notification('en') data['node'] = yield admin.node.admin_serialize_node('en') data['tip'] = self.dummyRTips[0] comments = yield rtip.get_comment_list_receiver(self.dummyReceiver_1['id'], data['tip']['id']) data['comment'] = comments[0] messages = yield rtip.get_messages_list(self.dummyReceiver_1['id'], data['tip']['id']) data['message'] = messages[0] files = yield rtip.get_files_receiver(self.dummyReceiver_1['id'], 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) ret = Templating().format_template(template, data)