Пример #1
0
    def check_wb_messages_expected(self, expected_msgs):

        x = yield wbtip.get_messages_content(self.wb_tip_id, self.receiver1_desc['id'])
        self.assertEqual(len(x), expected_msgs)

        y = yield wbtip.get_messages_content(self.wb_tip_id, self.receiver2_desc['id'])
        self.assertEqual(len(y), expected_msgs)
Пример #2
0
    def check_wb_messages_expected(self, expected_msgs):

        x = yield wbtip.get_messages_content(self.wb_tip_id, self.receiver1_desc['id'])
        self.assertEqual(len(x), expected_msgs)

        y = yield wbtip.get_messages_content(self.wb_tip_id, self.receiver2_desc['id'])
        self.assertEqual(len(y), expected_msgs)
Пример #3
0
    def do_receivers_messages_and_unread_verification(self):
        # Receiver1 check the presence of the whistleblower message (only 1)
        x = yield receiver.get_receivertip_list(self.receiver1_desc['id'],
                                                'en')

        # Receiver1 send one message
        msgrequest = {'content': u'Receiver1 send a message to WB'}
        k = yield rtip.create_message_receiver(self.receiver1_desc['id'],
                                               self.rtip1_id, msgrequest)
        self.assertEqual(k['visualized'], False)
        self.assertEqual(k['content'], msgrequest['content'])

        # Whistleblower check the presence of receiver1 unread message
        receiver_info_list = yield wbtip.get_wbtip_receivers_list(
            self.wbtip_id, 'en')

        for r in receiver_info_list:
            if r['id'] == self.receiver1_desc['id']:
                self.assertEqual(r['name'], self.receiver1_desc['name'])
            else:
                self.assertEqual(r['name'], self.receiver2_desc['name'])

        # Receiver2 check the presence of the whistleblower message (2 expected)
        a = yield receiver.get_receivertip_list(self.receiver1_desc['id'],
                                                'en')
        self.assertEqual(len(a), 1)

        # Receiver2 READ the messages from the whistleblower
        unread = yield rtip.get_messages_list(self.receiver2_desc['id'],
                                              self.rtip2_id)
        self.assertEqual(unread[0]['visualized'], unread[1]['visualized'])
        self.assertEqual(unread[0]['visualized'], False)

        readed = yield rtip.get_messages_list(self.receiver2_desc['id'],
                                              self.rtip2_id)
        self.assertEqual(readed[0]['visualized'], readed[1]['visualized'])
        self.assertEqual(readed[0]['visualized'], True)

        # Receiver2 send two message
        msgrequest = {'content': u'Receiver2 send #1/2 message to WB'}
        yield rtip.create_message_receiver(self.receiver2_desc['id'],
                                           self.rtip2_id, msgrequest)

        msgrequest = {'content': u'Receiver2 send #2/2 message to WB'}
        yield rtip.create_message_receiver(self.receiver2_desc['id'],
                                           self.rtip2_id, msgrequest)

        # Whistleblower read the messages from Receiver2
        wunread = yield wbtip.get_messages_content(self.wbtip_id,
                                                   self.receiver2_desc['id'])
        self.assertEqual(len(wunread), 4)  # two msg from Wb, two from R2
        self.assertFalse(wunread[2]['visualized'])
        self.assertFalse(wunread[3]['visualized'])

        wreaded = yield wbtip.get_messages_content(self.wbtip_id,
                                                   self.receiver2_desc['id'])
        self.assertTrue(wreaded[2]['visualized'])
        self.assertTrue(wreaded[3]['visualized'])
Пример #4
0
    def do_receivers_messages_and_unread_verification(self):
        # Receiver1 check the presence of the whistleblower message (only 1)
        x = yield receiver.get_receivertip_list(self.receiver1_desc['id'], 'en')

        # Receiver1 send one message
        msgrequest = { 'content': u'Receiver1 send a message to WB' }
        k = yield rtip.create_message_receiver(self.receiver1_desc['id'],
                                               self.rtip1_id, msgrequest)
        self.assertEqual(k['visualized'], False)
        self.assertEqual(k['content'], msgrequest['content'])

        # Whistleblower check the presence of receiver1 unread message
        receiver_info_list = yield wbtip.get_wbtip_receivers_list(self.wbtip_id, 'en')

        for r in receiver_info_list:
            if r['id'] == self.receiver1_desc['id']:
                self.assertEqual(r['name'], self.receiver1_desc['name'])
            else:
                self.assertEqual(r['name'], self.receiver2_desc['name'])

        # Receiver2 check the presence of the whistleblower message (2 expected)
        a = yield receiver.get_receivertip_list(self.receiver1_desc['id'], 'en')
        self.assertEqual(len(a), 1)

        # Receiver2 READ the messages from the whistleblower
        unread = yield rtip.get_messages_list(self.receiver2_desc['id'], self.rtip2_id)
        self.assertEqual(unread[0]['visualized'], unread[1]['visualized'])
        self.assertEqual(unread[0]['visualized'], False)

        readed = yield rtip.get_messages_list(self.receiver2_desc['id'], self.rtip2_id)
        self.assertEqual(readed[0]['visualized'], readed[1]['visualized'])
        self.assertEqual(readed[0]['visualized'], True)

        # Receiver2 send two message
        msgrequest = { 'content': u'Receiver2 send #1/2 message to WB' }
        yield rtip.create_message_receiver(self.receiver2_desc['id'],
                                           self.rtip2_id, msgrequest)

        msgrequest = { 'content': u'Receiver2 send #2/2 message to WB' }
        yield rtip.create_message_receiver(self.receiver2_desc['id'],
                                           self.rtip2_id, msgrequest)

        # Whistleblower read the messages from Receiver2
        wunread = yield wbtip.get_messages_content(self.wbtip_id, self.receiver2_desc['id'])
        self.assertEqual(len(wunread), 4) # two msg from Wb, two from R2
        self.assertFalse(wunread[2]['visualized'])
        self.assertFalse(wunread[3]['visualized'])

        wreaded = yield wbtip.get_messages_content(self.wbtip_id, self.receiver2_desc['id'])
        self.assertTrue(wreaded[2]['visualized'])
        self.assertTrue(wreaded[3]['visualized'])