Example #1
0
 def test_no_previous_execution(self, mock_run):
     datawatch.get_all_registered_checks = mock.MagicMock(return_value=[
         CheckRunEvery])
     scheduler = Scheduler()
     scheduler.get_last_executions = mock.MagicMock(return_value={})
     scheduler.run_checks()
     self.assertTrue(mock_run.called)
Example #2
0
 def test_skip_no_run_every(self, mock_run):
     datawatch.get_all_registered_checks = mock.MagicMock(return_value=[
         CheckNoRunEvery])
     scheduler = Scheduler()
     scheduler.get_last_executions = mock.MagicMock(return_value={})
     scheduler.run_checks()
     self.assertFalse(mock_run.called)
Example #3
0
    def test_execution_in_future_and_force(self, mock_run):
        datawatch.get_all_registered_checks = mock.MagicMock(return_value=[
            CheckRunEvery])
        scheduler = Scheduler()

        scheduler.get_last_executions = mock.MagicMock(return_value={
            'django_datawatch.tests.test_scheduler.CheckRunEvery':
                datetime.datetime(2016, 12, 1, 0, 0, 0, 0, pytz.timezone(
                    settings.TIME_ZONE)),
        })
        scheduler.run_checks(force=True)
        self.assertTrue(mock_run.called)
Example #4
0
def django_datawatch_scheduler(*args, **kwargs):
    Scheduler().run_checks(force=False)
 def handle(self, force, slug, *args, **options):
     Scheduler().run_checks(force=force, slug=slug)
Example #6
0
 def run(self, *args, **kwargs):
     Scheduler().run_checks(force=False)