Exemple #1
0
 def test_infinite_retryable_error(self):
     test_job = Job(func=retryable_error_task,
                    max_retries=0)
     self.assertEqual(test_job.retry, 0)
     with self.assertRaises(RetryableJobError):
         test_job.perform(self.session)
     self.assertEqual(test_job.retry, 1)
Exemple #2
0
 def test_perform_args(self):
     test_job = Job(func=dummy_task_args,
                    model_name='res.users',
                    args=('o', 'k'),
                    kwargs={'c': '!'})
     result = test_job.perform(self.session)
     self.assertEqual(result, 'ok!')
Exemple #3
0
 def test_retryable_error(self):
     test_job = Job(func=retryable_error_task,
                    max_retries=3)
     self.assertEqual(test_job.retry, 0)
     with self.assertRaises(RetryableJobError):
         test_job.perform(self.session)
     self.assertEqual(test_job.retry, 1)
     with self.assertRaises(RetryableJobError):
         test_job.perform(self.session)
     self.assertEqual(test_job.retry, 2)
     with self.assertRaises(FailedJobError):
         test_job.perform(self.session)
     self.assertEqual(test_job.retry, 3)
Exemple #4
0
 def test_context_uuid(self):
     test_job = Job(func=dummy_task_context)
     result = test_job.perform(self.session)
     key_present = 'job_uuid' in result
     self.assertTrue(key_present)
     self.assertEqual(result['job_uuid'], test_job._uuid)
Exemple #5
0
 def test_perform(self):
     test_job = Job(func=dummy_task)
     result = test_job.perform(self.session)
     self.assertEqual(result, 'ok')