def test_no_comletion(self): """Ensure does not fail if there's no completion checker.""" from furious.async import Async from furious.processors import _handle_context_completion_check async = Async(dir) _handle_context_completion_check(async)
def test_checker_called_with_async(self): """Ensure checker called with id as argument.""" from furious.async import Async from furious.processors import _handle_context_completion_check async = Async(dir) checker = Mock() async.update_options(_context_checker=checker) _handle_context_completion_check(async) checker.assert_called_once_with(async)
def test_async_checker_called_with_id(self): """Ensure an Async checker called with id as argument.""" from furious.async import Async from furious.processors import _handle_context_completion_check async = Async(dir) checker = Mock(spec=Async) async.update_options(_context_checker=checker) _handle_context_completion_check(async) checker.update_options.assert_called_once_with(args=['someid']) checker.start.assert_called_once_with() # Make sure didn't try to "call" the Async. self.assertEqual(checker.call_count, 0)