def test_get_workflow(): """ Tests the get_workflow method """ helper = WorkflowHelper('') helper._get_dag_run_like_id_db = lambda dag_id, execution_date: [DAG_RUN_1] helper._get_tasks_by_id_db = lambda dag_id, execution_date: TASK_LIST dag_detail = helper.get_workflow( workflow_id='dag_id__1957-03-14T12:12:12.000000' ) assert dag_detail['dag_id'] == 'did2' assert len(dag_detail['steps']) == 3 dag_detail = helper.get_workflow( workflow_id='NOTHING' ) assert dag_detail == {}
def test_get_workflow_subords(): """ Tests the get_workflow method """ helper = WorkflowHelper('') helper._get_dag_run_like_id_db = ( lambda dag_id, execution_date: [DAG_RUN_SUB, DAG_RUN_1] ) helper._get_tasks_by_id_db = lambda dag_id, execution_date: TASK_LIST dag_detail = helper.get_workflow( workflow_id='dag_id__1957-03-14T12:12:12.000000' ) assert dag_detail['dag_id'] == 'did2' assert len(dag_detail['sub_dags']) == 1 assert dag_detail['sub_dags'][0]['dag_id'] == 'did2.didnt' assert len(dag_detail['steps']) == 3