Ejemplo n.º 1
0
    def test_schedule_exception_handler__no_raise(self):
        # no raise
        process_id = uniqid()
        schedule_id = '%s%s' % (uniqid(), uniqid())
        with schedule.schedule_exception_handler(process_id, schedule_id):
            pass

        Status.objects.filter.assert_not_called()
        PipelineProcess.objects.get.assert_not_called()
        schedule.delete_parent_data.assert_not_called()
Ejemplo n.º 2
0
    def test_schedule_exception_handler__raise_and_not_find_corresponding_status(self):
        e = Exception()
        process = MockPipelineProcess()
        process_id = uniqid()
        schedule_id = '%s%s' % (uniqid(), uniqid())
        with mock.patch(PIPELINE_PROCESS_GET, mock.MagicMock(return_value=process)):
            with schedule.schedule_exception_handler(process_id, schedule_id):
                raise e

            Status.objects.filter.assert_called_once_with(id=schedule_id[:32], version=schedule_id[32:])

            PipelineProcess.objects.get.assert_not_called()

            process.exit_gracefully.assert_not_called()

            schedule.delete_parent_data.assert_called_once_with(schedule_id)