Example #1
0
 def test_update_race_workflow_deleted(self):
     workflow = Workflow.create_and_init()
     wf_module = workflow.tabs.first().wf_modules.create(
         order=0,
         slug="step-1",
         auto_update_data=True,
         update_interval=3600,
         next_update=parser.parse("2000-01-01T01:00Z"),
     )
     workflow.delete()
     # does not crash
     self.run_with_async_db(
         fetch.update_next_update_time(workflow.id, wf_module,
                                       parser.parse("2001-01-01T02:59Z")))
Example #2
0
 def test_update_race_auto_update_disabled(self):
     workflow = Workflow.create_and_init()
     wf_module = workflow.tabs.first().wf_modules.create(
         order=0,
         slug="step-1",
         auto_update_data=False,
         update_interval=3600,
         next_update=None,
     )
     self.run_with_async_db(
         fetch.update_next_update_time(workflow.id, wf_module,
                                       parser.parse("2001-01-01T02:59Z")))
     wf_module.refresh_from_db()
     self.assertIsNone(wf_module.next_update)
Example #3
0
 def test_update_race_step_deleted(self):
     workflow = Workflow.create_and_init()
     step = workflow.tabs.first().steps.create(
         order=0,
         slug="step-1",
         auto_update_data=True,
         update_interval=3600,
         next_update=parser.parse("2000-01-01T01:00"),
     )
     Step.objects.filter(id=step.id).delete()
     # does not crash
     self.run_with_async_db(
         fetch.update_next_update_time(workflow.id, step,
                                       parser.parse("2001-01-01T02:59")))
Example #4
0
 def test_update_skip_missed_updates(self):
     workflow = Workflow.create_and_init()
     step = workflow.tabs.first().steps.create(
         order=0,
         slug="step-1",
         auto_update_data=True,
         update_interval=3600,
         next_update=parser.parse("2000-01-01T01:00"),
     )
     self.run_with_async_db(
         fetch.update_next_update_time(workflow.id, step,
                                       parser.parse("2001-01-01T03:59")))
     step.refresh_from_db()
     self.assertEqual(step.next_update, parser.parse("2001-01-01T04:00"))
Example #5
0
 def test_update_on_schedule(self):
     workflow = Workflow.create_and_init()
     wf_module = workflow.tabs.first().wf_modules.create(
         order=0,
         slug="step-1",
         auto_update_data=True,
         update_interval=3600,
         next_update=parser.parse("2000-01-01T01:00Z"),
     )
     self.run_with_async_db(
         fetch.update_next_update_time(
             workflow.id, wf_module, parser.parse("2001-01-01T01:00:01Z")))
     wf_module.refresh_from_db()
     self.assertEqual(wf_module.last_update_check,
                      parser.parse("2001-01-01T01:00:01Z"))
     self.assertEqual(wf_module.next_update,
                      parser.parse("2001-01-01T02:00Z"))