Ejemplo 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)
Ejemplo n.º 2
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)
Ejemplo 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))
Ejemplo n.º 4
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))
Ejemplo n.º 5
0
 def test_require_with_TransactionFreeOperation(self):
     """If TransactionFreeOperation is used, do not raise."""
     with TransactionFreeOperation.require():
         with TransactionFreeOperation():
             pass
Ejemplo 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
Ejemplo n.º 7
0
 def test_require_with_TransactionFreeOperation(self):
     """If TransactionFreeOperation is used, do not raise."""
     with TransactionFreeOperation.require():
         with TransactionFreeOperation():
             pass
Ejemplo 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