Ejemplo n.º 1
0
 def test_run_one(self):
     job = JobFactory.create()
     call_command('run_jobs', job.id, stdout=self.stdout)
     self.stdout.seek(0)
     self.assertIn('Started', self.stdout.read())
Ejemplo n.º 2
0
 def test_filter_tags(self, mock_stop, mock_run_job, mock_sleep):
     JobFactory.create(tag='foo', is_active=True)
     JobFactory.create(tag='bar', is_active=True)
     JobFactory.create(tag='ham', is_active=True)
     call_command('crond', '--tags', 'foo', 'bar', stdout=self.stdout)
     self.assertEqual(mock_run_job.call_count, 2)
Ejemplo n.º 3
0
 def test_run_with_error(self, mock):
     job = JobFactory.create()
     with self.assertRaises(Exception):
         self.command.run_job(job)
Ejemplo n.º 4
0
 def test_run(self, mock):
     job = JobFactory.create()
     result = self.command.run_job(job)
     self.assertIsNotNone(result)
     self.assertIsInstance(result, datetime)
Ejemplo n.º 5
0
 def test_not_now(self, mock):
     job = JobFactory.create()
     result = self.command.run_job(job)
     self.assertIsNone(result)
Ejemplo n.º 6
0
 def test_run_two(self):
     job1, job2 = JobFactory.create_batch(2)
     call_command('run_jobs', job1.id, job2.id, stdout=self.stdout)
     self.stdout.seek(0)
     self.assertIn('Started', self.stdout.read())