示例#1
0
    def test_sync_to_inbox_instantiates_threadpool(self):
        patcher = patch('messor.drop_off.ThreadPoolExecutor')
        self.addCleanup(patcher.stop)
        self.threadpool = patcher.start()

        sync_to_inbox('host1', self.conn)

        self.threadpool.assert_called_once_with(max_workers=16)
示例#2
0
    def test_sync_to_inbox_processes_all_files_for_host(self):
        sync_to_inbox('host1', self.conn)

        expected_calls = [
                call(self.mock_file_entries[0], self.conn),
                call(self.mock_file_entries[1], self.conn),
                call(self.mock_file_entries[2], self.conn),
        ]
        self.assertEqual(expected_calls, self.process_file.mock_calls)
示例#3
0
    def test_sync_to_inbox_waits_for_threads_to_finish(self):
        ret = sync_to_inbox('host1', self.conn)

        self.assertIsInstance(ret, list)
        self.assertNotIsInstance(ret, GeneratorType)
示例#4
0
    def test_sync_to_inbox_gets_file_index_for_host(self):
        sync_to_inbox('host1', self.conn)

        self.file_index_for_host.assert_called_once_with('host1')