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)
 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))
 def test_require_with_TransactionFreeOperation(self):
     """If TransactionFreeOperation is used, do not raise."""
     with TransactionFreeOperation.require():
         with TransactionFreeOperation():
             pass
 def test_require_no_TransactionFreeOperation(self):
     """If TransactionFreeOperation is not used, raise."""
     with ExpectedException(AssertionError,
                            'TransactionFreeOperation was not used.'):
         with TransactionFreeOperation.require():
             pass
 def test_require_with_TransactionFreeOperation(self):
     """If TransactionFreeOperation is used, do not raise."""
     with TransactionFreeOperation.require():
         with TransactionFreeOperation():
             pass
 def test_require_no_TransactionFreeOperation(self):
     """If TransactionFreeOperation is not used, raise."""
     with ExpectedException(
             AssertionError, 'TransactionFreeOperation was not used.'):
         with TransactionFreeOperation.require():
             pass