コード例 #1
0
    def test_get_matching_rows_status_comparisons(self):
        table = NetUseTable()
        row = table.add_row({'local': '', 'remote': '', 'status': 'ABC'})

        self.assertEqual(table.get_matching_rows(status='ABC'), [row])
        self.assertEqual(table.get_matching_rows(status='abc'), [row])
        self.assertEqual(table.get_matching_rows(status='cba'), [])
コード例 #2
0
    def test_get_matching_rows_status_comparisons(self):
        table = NetUseTable()
        row = table.add_row({'local': '', 'remote': '', 'status': 'ABC'})

        self.assertEqual(table.get_matching_rows(status='ABC'), [row])
        self.assertEqual(table.get_matching_rows(status='abc'), [row])
        self.assertEqual(table.get_matching_rows(status='cba'), [])
コード例 #3
0
    def test_get_matching_rows_local_comparisons(self):
        table = NetUseTable()
        row = table.add_row({'local': 'A:', 'remote': '', 'status': ''})

        self.assertEqual(table.get_matching_rows(local='a'), [row])
        self.assertEqual(table.get_matching_rows(local='A'), [row])
        self.assertEqual(table.get_matching_rows(local='a:'), [row])
        self.assertEqual(table.get_matching_rows(local='A:'), [row])
        self.assertEqual(table.get_matching_rows(local='b:'), [])
コード例 #4
0
    def test_get_connected_devices(self):
        table = NetUseTable()
        self.assertEqual(table.get_connected_devices(), [])

        table.add_row({'local': 'A', 'remote': r'\\remote', 'status': 'status'})
        self.assertEqual(table.get_connected_devices(), [DiskDrive('A:')])

        table.add_row({'local': 'B', 'remote': r'\\remote', 'status': 'status'})
        self.assertEqual(table.get_connected_devices(), [DiskDrive('A:'), DiskDrive('B:')])
コード例 #5
0
    def test_get_mounted_paths(self):
        table = NetUseTable()
        self.assertEqual(table.get_connected_paths(), [])

        table.add_row({'local': 'A', 'remote': r'\\remote1', 'status': 'status'})
        self.assertEqual(table.get_connected_paths(), [UncDirectory(r'\\remote1')])

        table.add_row({'local': 'A', 'remote': r'\\remote2', 'status': 'status'})
        self.assertEqual(table.get_connected_paths(), [UncDirectory(r'\\remote1'),
                                                       UncDirectory(r'\\remote2')])
コード例 #6
0
    def test_get_matching_rows_remote_comparisons(self):
        table = NetUseTable()
        row = table.add_row({
            'local': '',
            'remote': r'\\remote\a\IPC$',
            'status': ''
        })

        self.assertEqual(table.get_matching_rows(remote=r'\\remote\a'), [row])
        self.assertEqual(table.get_matching_rows(remote=r'\\remote\a\\'),
                         [row])
        self.assertEqual(table.get_matching_rows(remote=r'\\Remote\A'), [row])
        self.assertEqual(table.get_matching_rows(remote=r'\\remote\a\IPC$'),
                         [row])
        self.assertEqual(table.get_matching_rows(remote=r'\\remote\a\ipc$'),
                         [row])
        self.assertEqual(table.get_matching_rows(remote=r'\\remote\b'), [])
コード例 #7
0
    def test_get_matching_rows_remote_comparisons(self):
        table = NetUseTable()
        row = table.add_row({'local': '', 'remote': r'\\remote\a\IPC$', 'status': ''})

        self.assertEqual(table.get_matching_rows(remote=r'\\remote\a'), [row])
        self.assertEqual(table.get_matching_rows(remote=r'\\remote\a\\'), [row])
        self.assertEqual(table.get_matching_rows(remote=r'\\Remote\A'), [row])
        self.assertEqual(table.get_matching_rows(remote=r'\\remote\a\IPC$'), [row])
        self.assertEqual(table.get_matching_rows(remote=r'\\remote\a\ipc$'), [row])
        self.assertEqual(table.get_matching_rows(remote=r'\\remote\b'), [])
コード例 #8
0
    def test_get_connected_devices(self):
        table = NetUseTable()
        self.assertEqual(table.get_connected_devices(), [])

        table.add_row({
            'local': 'A',
            'remote': r'\\remote',
            'status': 'status'
        })
        self.assertEqual(table.get_connected_devices(), [DiskDrive('A:')])

        table.add_row({
            'local': 'B',
            'remote': r'\\remote',
            'status': 'status'
        })
        self.assertEqual(table.get_connected_devices(),
                         [DiskDrive('A:'), DiskDrive('B:')])
コード例 #9
0
    def test_get_matching_rows_local_comparisons(self):
        table = NetUseTable()
        row = table.add_row({'local': 'A:', 'remote': '', 'status': ''})

        self.assertEqual(table.get_matching_rows(local='a'), [row])
        self.assertEqual(table.get_matching_rows(local='A'), [row])
        self.assertEqual(table.get_matching_rows(local='a:'), [row])
        self.assertEqual(table.get_matching_rows(local='A:'), [row])
        self.assertEqual(table.get_matching_rows(local='b:'), [])
コード例 #10
0
    def test_get_mounted_paths(self):
        table = NetUseTable()
        self.assertEqual(table.get_connected_paths(), [])

        table.add_row({
            'local': 'A',
            'remote': r'\\remote1',
            'status': 'status'
        })
        self.assertEqual(table.get_connected_paths(),
                         [UncDirectory(r'\\remote1')])

        table.add_row({
            'local': 'A',
            'remote': r'\\remote2',
            'status': 'status'
        })
        self.assertEqual(
            table.get_connected_paths(),
            [UncDirectory(r'\\remote1'),
             UncDirectory(r'\\remote2')])
コード例 #11
0
    def test_get_matching_rows_selecting(self):
        table = NetUseTable()

        self.assertEqual(table.get_matching_rows(), [])
        self.assertEqual(table.get_matching_rows(local=r'A'), [])

        row1 = table.add_row({
            'local': 'A',
            'remote': r'\\remote2',
            'status': 'status1'
        })
        row2 = table.add_row({
            'local': 'A',
            'remote': r'\\remote1',
            'status': 'status2'
        })
        row3 = table.add_row({
            'local': 'B',
            'remote': r'\\remote1',
            'status': 'status1'
        })

        self.assertEqual(table.get_matching_rows(), [row1, row2, row3])
        self.assertEqual(table.get_matching_rows(local='Z'), [])
        self.assertEqual(table.get_matching_rows(remote=r'\\remote0'), [])
        self.assertEqual(table.get_matching_rows(status='status0'), [])
        self.assertEqual(table.get_matching_rows(local='A'), [row1, row2])
        self.assertEqual(table.get_matching_rows(remote=r'\\remote1'),
                         [row2, row3])
        self.assertEqual(table.get_matching_rows(status='status1'),
                         [row1, row3])
        self.assertEqual(
            table.get_matching_rows(local='B', remote=r'\\remote2'), [])
        self.assertEqual(
            table.get_matching_rows(local='A', remote=r'\\remote1'), [row2])
        self.assertEqual(table.get_matching_rows(local='A', status='status1'),
                         [row1])
        self.assertEqual(
            table.get_matching_rows(remote=r'\\remote1', status='status1'),
            [row3])

        self.assertEqual(
            table.get_matching_rows(local='A',
                                    remote=r'\\remote2',
                                    status='status1'), [row1])
コード例 #12
0
    def test_get_matching_rows_selecting(self):
        table = NetUseTable()

        self.assertEqual(table.get_matching_rows(), [])
        self.assertEqual(table.get_matching_rows(local=r'A'), [])

        row1 = table.add_row({'local': 'A', 'remote': r'\\remote2', 'status': 'status1'})
        row2 = table.add_row({'local': 'A', 'remote': r'\\remote1', 'status': 'status2'})
        row3 = table.add_row({'local': 'B', 'remote': r'\\remote1', 'status': 'status1'})

        self.assertEqual(table.get_matching_rows(), [row1, row2, row3])
        self.assertEqual(table.get_matching_rows(local='Z'), [])
        self.assertEqual(table.get_matching_rows(remote=r'\\remote0'), [])
        self.assertEqual(table.get_matching_rows(status='status0'), [])
        self.assertEqual(table.get_matching_rows(local='A'), [row1, row2])
        self.assertEqual(table.get_matching_rows(remote=r'\\remote1'), [row2, row3])
        self.assertEqual(table.get_matching_rows(status='status1'), [row1, row3])
        self.assertEqual(table.get_matching_rows(local='B', remote=r'\\remote2'), [])
        self.assertEqual(table.get_matching_rows(local='A', remote=r'\\remote1'), [row2])
        self.assertEqual(table.get_matching_rows(local='A', status='status1'), [row1])
        self.assertEqual(table.get_matching_rows(remote=r'\\remote1', status='status1'), [row3])

        self.assertEqual(table.get_matching_rows(local='A',
                                                 remote=r'\\remote2',
                                                 status='status1'),
                         [row1])