Exemplo n.º 1
0
 def wb_get_receivers_list(self, language):
     receivers_list = yield wbtip.get_wbtip_receivers_list(
         self.wbtip_id, language)
     self.assertEqual(len(receivers_list), 2)
     self.assertEqual(
         receivers_list[0]['access_counter'] +
         receivers_list[1]['access_counter'], 2)
Exemplo n.º 2
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'])
Exemplo n.º 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'])
Exemplo n.º 4
0
    def do_wb_messages(self):
        before = yield wbtip.get_wbtip_receivers_list(self.wbtip_id, 'en')

        # the direct message has been sent to the receiver 1, and receiver 1
        # is on the element [0] of the list.
        self.assertEqual(len(before), 2)

        msgrequest = { 'content': u'a msg from wb to receiver1' }
        x = yield wbtip.create_message_wb(self.wbtip_id,
                                          self.receiver1_desc['id'], msgrequest)

        self.assertEqual(x['author'], u'whistleblower')

        # and now, two messages for the second receiver
        msgrequest = { 'content': u'#1/2 msg from wb to receiver2' }
        yield wbtip.create_message_wb(self.wbtip_id,
                                          self.receiver2_desc['id'], msgrequest)
        msgrequest = { 'content': u'#2/2 msg from wb to receiver2' }
        yield wbtip.create_message_wb(self.wbtip_id,
                                          self.receiver2_desc['id'], msgrequest)
Exemplo n.º 5
0
    def do_wb_messages(self):
        before = yield wbtip.get_wbtip_receivers_list(self.wbtip_id, 'en')

        # the direct message has been sent to the receiver 1, and receiver 1
        # is on the element [0] of the list.
        self.assertEqual(len(before), 2)

        msgrequest = {'content': u'a msg from wb to receiver1'}
        x = yield wbtip.create_message_wb(self.wbtip_id,
                                          self.receiver1_desc['id'],
                                          msgrequest)

        self.assertEqual(x['author'], u'whistleblower')

        # and now, two messages for the second receiver
        msgrequest = {'content': u'#1/2 msg from wb to receiver2'}
        yield wbtip.create_message_wb(self.wbtip_id, self.receiver2_desc['id'],
                                      msgrequest)
        msgrequest = {'content': u'#2/2 msg from wb to receiver2'}
        yield wbtip.create_message_wb(self.wbtip_id, self.receiver2_desc['id'],
                                      msgrequest)
Exemplo n.º 6
0
 def wb_get_receivers_list(self, language):
     receivers_list = yield wbtip.get_wbtip_receivers_list(self.wbtip_id, language)
     self.assertEqual(len(receivers_list), 2)
     self.assertEqual(receivers_list[0]['access_counter'] + receivers_list[1]['access_counter'], 2)