def test_local_task_failure(self): t = Task('KBParallelTestModule', 'do_something', 'dev', {'throw_error': 1}, self.token) t.start(self.callback_url, 'local') while not t.is_done(): time.sleep(0.2) self.assertFalse(t.success()) result_package = t.get_task_result_package() self.assertEqual(result_package['result_package']['result'], None) self.assertTrue( 'doing as you wish' in result_package['result_package']['error'])
def test_task(self): t = Task('KBParallelTestModule', 'do_something', 'dev', {'number': 5}, self.token) t.start(self.callback_url, 'local') while not t.is_done(): time.sleep(0.2) self.assertTrue(t.success()) result_package = t.get_task_result_package() self.assertEqual( result_package['result_package']['result'][0]['new_number'], 500)