Beispiel #1
0
    def test_class(self):
        # Setup
        contact_list           = ContactList(nicks=['Alice', 'Bob', 'local'])
        group_list             = GroupList(groups=['testgroup'])
        packet_list            = PacketList()
        settings               = Settings()
        window_list            = WindowList(contact_list, group_list, packet_list, settings)
        window_list.active_win = window_list.get_window('*****@*****.**')

        # Test
        self.assertEqual(len(window_list), 3)

        for w in window_list:
            self.assertIsInstance(w, Window)

        self.assertIsNone(window_list.select_rx_window('*****@*****.**'))

        self.assertTrue(window_list.active_win.is_active)
        self.assertEqual(window_list.active_win, window_list.get_window('*****@*****.**'))

        self.assertTrue(window_list.has_window('*****@*****.**'))
        self.assertFalse(window_list.has_window('*****@*****.**'))

        local_win = window_list.get_local_window()
        self.assertIsInstance(local_win, Window)
        self.assertEqual(local_win.name, 'system messages')

        file_win = window_list.get_window('file_window')
        self.assertIsInstance(file_win, FileWindow)
Beispiel #2
0
    def test_class(self):
        # Setup
        packet_list = PacketList()
        file_window = FileWindow('*****@*****.**', packet_list)

        # Test
        self.assertIsNone(file_window.redraw())

        packet_list.packet_l = [Packet(assembly_pt_list=[5*b'a'],
                                       type='file',
                                       f_size=b'30kb',
                                       contact=create_contact(nick='Alice'),
                                       f_packets=20)]

        file_window = FileWindow('*****@*****.**', packet_list)
        self.assertIsNone(file_window.redraw())
Beispiel #3
0
    def setUp(self):
        self.contact_list = ContactList(
            nicks=['Alice', 'Bob', 'Charlie', LOCAL_ID])
        self.group_list = GroupList(groups=['test_group', 'test_group2'])
        self.settings = Settings()
        self.packet_list = PacketList()
        self.ts = datetime.fromtimestamp(1502750000)
        self.time = self.ts.strftime('%H:%M')

        group = self.group_list.get_group('test_group')
        group.members = list(
            map(self.contact_list.get_contact, ['Alice', 'Bob', 'Charlie']))
Beispiel #4
0
    def setUp(self):
        self.settings = Settings()
        self.contact_list = ContactList(
            nicks=['Alice', 'Bob', 'Charlie', LOCAL_ID])
        self.group_list = GroupList(groups=['test_group', 'test_group2'])
        self.packet_list = PacketList()

        group = self.group_list.get_group('test_group')
        group.members = list(
            map(self.contact_list.get_contact, ['Alice', 'Bob', 'Charlie']))

        self.window_list = WindowList(self.settings, self.contact_list,
                                      self.group_list, self.packet_list)
Beispiel #5
0
    def setUp(self):
        """Pre-test actions."""
        self.contact_list = ContactList(
            nicks=['Alice', 'Bob', 'Charlie', LOCAL_ID])
        self.group_list = GroupList(groups=['test_group', 'test_group2'])
        self.settings = Settings()
        self.packet_list = PacketList()
        self.ts = datetime.fromtimestamp(1502750000)
        self.time = self.ts.strftime('%H:%M:%S.%f')[:-4]

        group = self.group_list.get_group('test_group')
        group.members = list(
            map(self.contact_list.get_contact_by_address_or_nick,
                ['Alice', 'Bob', 'Charlie']))
Beispiel #6
0
    def setUp(self) -> None:
        """Pre-test actions."""
        self.settings = Settings()
        self.contact_list = ContactList(
            nicks=['Alice', 'Bob', 'Charlie', LOCAL_ID])
        self.group_list = GroupList(groups=['test_group', 'test_group2'])
        self.packet_list = PacketList()

        group = self.group_list.get_group('test_group')
        group.members = list(
            map(self.contact_list.get_contact_by_address_or_nick,
                ['Alice', 'Bob', 'Charlie']))

        self.window_list = WindowList(self.settings, self.contact_list,
                                      self.group_list, self.packet_list)