Esempio n. 1
0
 def test_run_missing_ready_not_enabled(self):
     """run_missing_ready does nothing if the class isn't enabled."""
     self.createMissingJob()
     with monitor_celery() as responses:
         with dbuser("run_missing_ready"):
             with TransactionFreeOperation.require():
                 self.RunMissingReady().run(_no_init=True)
     self.assertEqual([], responses)
 def test_run_missing_ready_not_enabled(self):
     """run_missing_ready does nothing if the class isn't enabled."""
     self.createMissingJob()
     with monitor_celery() as responses:
         with dbuser('run_missing_ready'):
             with TransactionFreeOperation.require():
                 self.RunMissingReady().run(_no_init=True)
     self.assertEqual([], responses)
Esempio n. 3
0
 def test_run_missing_ready(self):
     """run_missing_ready requests the job to run if not scheduled."""
     self.createMissingJob()
     self.useFixture(FeatureFixture({"jobs.celery.enabled_classes": "BranchScanJob"}))
     with monitor_celery() as responses:
         with dbuser("run_missing_ready"):
             with TransactionFreeOperation.require():
                 self.RunMissingReady().run(_no_init=True)
     self.assertEqual(1, len(responses))
 def test_run_missing_ready(self):
     """run_missing_ready requests the job to run if not scheduled."""
     self.createMissingJob()
     self.useFixture(
         FeatureFixture({'jobs.celery.enabled_classes': 'BranchScanJob'}))
     with monitor_celery() as responses:
         with dbuser('run_missing_ready'):
             with TransactionFreeOperation.require():
                 self.RunMissingReady().run(_no_init=True)
     self.assertEqual(1, len(responses))
Esempio n. 5
0
 def test_require_with_TransactionFreeOperation(self):
     """If TransactionFreeOperation is used, do not raise."""
     with TransactionFreeOperation.require():
         with TransactionFreeOperation():
             pass
Esempio n. 6
0
 def test_require_no_TransactionFreeOperation(self):
     """If TransactionFreeOperation is not used, raise."""
     with ExpectedException(AssertionError,
                            'TransactionFreeOperation was not used.'):
         with TransactionFreeOperation.require():
             pass
Esempio n. 7
0
 def test_require_with_TransactionFreeOperation(self):
     """If TransactionFreeOperation is used, do not raise."""
     with TransactionFreeOperation.require():
         with TransactionFreeOperation():
             pass
Esempio n. 8
0
 def test_require_no_TransactionFreeOperation(self):
     """If TransactionFreeOperation is not used, raise."""
     with ExpectedException(
             AssertionError, 'TransactionFreeOperation was not used.'):
         with TransactionFreeOperation.require():
             pass