def test_tasks_are_passed_along(self, queue_add_mock): """Ensure the list of tasks are passed along.""" from furious.context import _insert_tasks _insert_tasks(('A', 1, 'B', 'joe'), 'AbCd') queue_add_mock.assert_called_once_with(('A', 1, 'B', 'joe'), transactional=False)
def test_batches_get_split(self, queue_add_mock): """Ensure a batches get split and retried on errors.""" from furious.context import _insert_tasks def raise_transient(*args, **kwargs): from google.appengine.api import taskqueue raise taskqueue.TransientError() queue_add_mock.side_effect = raise_transient _insert_tasks(('A', 1, 'B'), 'AbCd') self.assertEqual(5, queue_add_mock.call_count)
def test_task_add_error(self, queue_add_mock): """Ensure an exception doesn't get raised from add.""" from furious.context import _insert_tasks def raise_transient(*args, **kwargs): from google.appengine.api import taskqueue raise taskqueue.TransientError() queue_add_mock.side_effect = raise_transient _insert_tasks(('A',), 'AbCd') queue_add_mock.assert_called_once_with(('A',), transactional=False)
def test_queue_name_is_honored(self, queue_mock): """Ensure the Queue is instantiated with the name.""" from furious.context import _insert_tasks _insert_tasks((None,), 'AbCd') queue_mock.assert_called_once_with(name='AbCd')
def test_no_tasks_doesnt_blow_up(self): """Ensure calling with an empty list doesn't blow up.""" from furious.context import _insert_tasks _insert_tasks((), 'A')