def test_fetch_schedules_later(self):
        """Test that schedules that do not need to run (next_run_at > now) are not returned."""
        self.install_fixture(
            "pipeline_schedule_interval", overrides={"next_run_at": datetime.utcnow() + timedelta(hours=6)}
        )

        self.assertEqual(PipelineScheduleRepository.fetch_schedules_to_run(), [])
Esempio n. 2
0
    def fetch_schedules_to_run(cls):
        """Return a list of PipelineScheduleEntities that need to run.

        :returns list: PipelineScheduleEntity
        """
        return map(
            PipelineScheduleMapper.to_entity,
            PipelineScheduleRepository.fetch_schedules_to_run(),
        )
Esempio n. 3
0
    def fetch_schedules_to_run(cls):
        """Return a list of PipelineScheduleEntities that need to run.

        :returns list: PipelineScheduleEntity
        """
        return map(
            PipelineScheduleMapper.to_entity,
            PipelineScheduleRepository.fetch_schedules_to_run(),
        )
    def test_fetch_schedules_manual(self):
        """Test that manual schedules that do not need to run
        (next_run_at == null) are not returned."""
        self.install_fixture('pipeline_schedule_manual')

        self.assertEqual(
            PipelineScheduleRepository.fetch_schedules_to_run(),
            [],
        )
    def test_fetch_schedules_to_run_locked(self):
        """Test that locked schedules are not returned."""
        self.install_fixture('pipeline_schedule_interval', overrides={
            'locked': True,
        })

        self.assertEqual(
            PipelineScheduleRepository.fetch_schedules_to_run(),
            [],
        )
    def test_fetch_schedules_later(self):
        """Test that schedules that do not need to run (next_run_at > now) are not returned."""
        self.install_fixture('pipeline_schedule_interval', overrides={
            'next_run_at': datetime.utcnow() + timedelta(hours=6),
        })

        self.assertEqual(
            PipelineScheduleRepository.fetch_schedules_to_run(),
            [],
        )
    def test_fetch_schedules_to_run(self):
        """Test that schedules that need to run (next_run_at <= now) are returned."""
        self.install_fixture('pipeline_schedule_interval')

        self.assertEqual(
            PipelineScheduleRepository.fetch_schedules_to_run(),
            [
                self.pipeline_schedule_interval,
            ]
        )
    def test_fetch_schedules_to_run_locked(self):
        """Test that locked schedules are not returned."""
        self.install_fixture("pipeline_schedule_interval", overrides={"locked": True})

        self.assertEqual(PipelineScheduleRepository.fetch_schedules_to_run(), [])
    def test_fetch_schedules_manual(self):
        """Test that manual schedules that do not need to run
        (next_run_at == null) are not returned."""
        self.install_fixture("pipeline_schedule_manual")

        self.assertEqual(PipelineScheduleRepository.fetch_schedules_to_run(), [])
    def test_fetch_schedules_to_run(self):
        """Test that schedules that need to run (next_run_at <= now) are returned."""
        self.install_fixture("pipeline_schedule_interval")

        self.assertEqual(PipelineScheduleRepository.fetch_schedules_to_run(), [self.pipeline_schedule_interval])