Esempio n. 1
0
    def test_start_hits_task_already_exists_error_error(self, queue_mock):
        """Ensure the task returns if a task already exists error is hit."""
        from google.appengine.api.taskqueue import TaskAlreadyExistsError
        from furious. async import Async

        queue_mock.return_value.add.side_effect = TaskAlreadyExistsError()

        async_job = Async("something", queue='my_queue')
        async_job.start()

        queue_mock.assert_called_with(name='my_queue')
        self.assertEqual(1, queue_mock.return_value.add.call_count)
Esempio n. 2
0
 def queue_add(tasks, transactional=False):
     if len(tasks) != 2:
         raise TaskAlreadyExistsError()