tanelk edited a comment on issue #22078:
URL: https://github.com/apache/airflow/issues/22078#issuecomment-1067650427


   Meanwhile these unit tests pass:
   
   ```
   def test_external_task_sensor_link_execution_delta(dag_maker, app):
       with dag_maker():
           ExternalTaskSensor(
               task_id='external_task_sensor',
               external_dag_id='external_dag_id',
               execution_delta=timedelta(days=1),
           )
   
       dagrun = dag_maker.create_dagrun(run_type=DagRunType.SCHEDULED, 
execution_date=DEFAULT_DATE)
       (instance,) = dagrun.task_instances
       instance.render_templates()
   
       # Verify that the operator link has correct execution_date
       app.config['SERVER_NAME'] = ""
       with app.app_context():
           url = instance.task.get_extra_links(instance, "External DAG")
   
           assert f"tree?dag_id=external_dag_id&execution_date={(DEFAULT_DATE - 
timedelta(days=1)).date()}" in url
   
   
   def test_external_task_sensor_link_execution_date_fn(dag_maker, app):
       with dag_maker():
           ExternalTaskSensor(
               task_id='external_task_sensor',
               external_dag_id='external_dag_id',
               execution_date_fn=lambda date: date - timedelta(days=1),
           )
   
       dagrun = dag_maker.create_dagrun(run_type=DagRunType.SCHEDULED, 
execution_date=DEFAULT_DATE)
       (instance,) = dagrun.task_instances
       instance.render_templates()
   
       # Verify that the operator link has correct execution_date
       app.config['SERVER_NAME'] = ""
       with app.app_context():
           url = instance.task.get_extra_links(instance, "External DAG")
   
           assert f"tree?dag_id=external_dag_id&execution_date={(DEFAULT_DATE - 
timedelta(days=1)).date()}" in url
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to