def test_run_completes_if_filter_fails(self): mock_filter = Filter('bob', max_results=5, fields=None, namespace='pyccata.core') mock_filter._failure = InvalidQueryError('query is wrong') Config = namedtuple('Config', 'rows columns style') config = Config(rows=[['My search', mock_filter]], columns=['Test column', 'Test Results'], style=None) table = Table(self._thread_manager, config) table.run() self.assertTrue(table._complete)
def test_run_completes_if_filter_delays_in_completing(self): mock_filter = Filter('bob', max_results=5, fields=None, namespace='pyccata.core') Config = namedtuple('Config', 'rows columns style') config = Config(rows=[['My search', mock_filter]], columns=['Test column', 'Test Results'], style=None) with patch('pyccata.core.threading.Threadable.complete', new_callable=PropertyMock) as mock_thread: table = Table(self._thread_manager, config) mock_thread.side_effect = [False, False, True] table.run() self.assertTrue(table._complete)