def run_datadoc(self, *args, **kwargs): """ This function wraps run_datadoc_with_config to convert legacy schedule config to current """ run_datadoc_with_config(self, *args, **convert_if_legacy_datadoc_schedule(kwargs))
def test_convert_semi_legacy(): assert convert_if_legacy_datadoc_schedule({ **unchanged_fields, "exporter_name": "foobar", "exporter_params": {}, }) == { **unchanged_fields, "exports": [] }
def get_datadoc_schedule(id): with DBSession() as session: assert_can_read(id, session=session) verify_data_doc_permission(id, session=session) schedule_name = schedule_logic.get_data_doc_schedule_name(id) schedule = schedule_logic.get_task_schedule_by_name(schedule_name, session=session) if not schedule: return None schedule_dict = schedule.to_dict() schedule_dict["kwargs"] = convert_if_legacy_datadoc_schedule( schedule_dict["kwargs"]) return schedule_dict
def test_convert_unchanged(): assert convert_if_legacy_datadoc_schedule( unchanged_fields) == unchanged_fields
def test_convert_legacy(): assert convert_if_legacy_datadoc_schedule(legacy_config) == current_config