Lee-W commented on code in PR #47381:
URL: https://github.com/apache/airflow/pull/47381#discussion_r2007095181
##########
tests/api_fastapi/core_api/routes/ui/test_structure.py:
##########
@@ -450,6 +279,196 @@ def test_should_return_200(self, test_client, params,
expected):
assert response.status_code == 200
assert response.json() == expected
+ @pytest.mark.usefixtures("make_dag")
+ def test_should_return_200_with_asset(self, test_client, asset3_id):
+ params = {
+ "dag_id": DAG_ID,
+ "external_dependencies": True,
+ }
+ expected = {
+ "edges": [
+ {
+ "is_setup_teardown": None,
+ "label": None,
+ "source_id": "and-gate-0",
+ "target_id": "task_1",
+ "is_source_asset": True,
+ },
+ {
+ "is_setup_teardown": None,
+ "label": None,
+ "source_id": "asset1",
+ "target_id": "and-gate-0",
+ "is_source_asset": None,
+ },
+ {
+ "is_setup_teardown": None,
+ "label": None,
+ "source_id": "asset2",
+ "target_id": "and-gate-0",
+ "is_source_asset": None,
+ },
+ {
+ "is_setup_teardown": None,
+ "label": None,
+ "source_id": "example-alias",
+ "target_id": "and-gate-0",
+ "is_source_asset": None,
+ },
+ {
+ "is_setup_teardown": None,
+ "label": None,
+ "source_id":
"sensor:dag_with_multiple_versions:dag_with_multiple_versions:external_task_sensor",
+ "target_id": "task_1",
+ "is_source_asset": None,
+ },
+ {
+ "is_setup_teardown": None,
+ "label": None,
+ "source_id":
"trigger:external_trigger:dag_with_multiple_versions:trigger_dag_run_operator",
+ "target_id": "task_1",
+ "is_source_asset": None,
+ },
+ {
+ "is_setup_teardown": None,
+ "label": None,
+ "source_id": "external_task_sensor",
+ "target_id": "task_2",
+ "is_source_asset": None,
+ },
+ {
+ "is_setup_teardown": None,
+ "label": None,
+ "source_id": "task_1",
+ "target_id": "external_task_sensor",
+ "is_source_asset": None,
+ },
+ {
+ "is_setup_teardown": None,
+ "label": None,
+ "source_id": "task_2",
+ "target_id": f"asset:{asset3_id}",
+ "is_source_asset": None,
+ },
+ ],
+ "nodes": [
+ {
+ "children": None,
+ "id": "task_1",
+ "is_mapped": None,
+ "label": "task_1",
+ "tooltip": None,
+ "setup_teardown_type": None,
+ "type": "task",
+ "operator": "EmptyOperator",
+ "asset_condition_type": None,
+ },
+ {
+ "children": None,
+ "id": "external_task_sensor",
+ "is_mapped": None,
+ "label": "external_task_sensor",
+ "tooltip": None,
+ "setup_teardown_type": None,
+ "type": "task",
+ "operator": "ExternalTaskSensor",
+ "asset_condition_type": None,
+ },
+ {
+ "children": None,
+ "id": "task_2",
+ "is_mapped": None,
+ "label": "task_2",
+ "tooltip": None,
+ "setup_teardown_type": None,
+ "type": "task",
+ "operator": "EmptyOperator",
+ "asset_condition_type": None,
+ },
+ {
+ "children": None,
+ "id": f"asset:{asset3_id}",
+ "is_mapped": None,
+ "label": "s3://dataset-bucket/example.csv",
+ "tooltip": None,
+ "setup_teardown_type": None,
+ "type": "asset",
+ "operator": None,
+ "asset_condition_type": None,
+ },
+ {
+ "children": None,
+ "id":
"sensor:dag_with_multiple_versions:dag_with_multiple_versions:external_task_sensor",
+ "is_mapped": None,
+ "label": "external_task_sensor",
+ "tooltip": None,
+ "setup_teardown_type": None,
+ "type": "sensor",
+ "operator": None,
+ "asset_condition_type": None,
+ },
+ {
+ "children": None,
+ "id":
"trigger:external_trigger:dag_with_multiple_versions:trigger_dag_run_operator",
+ "is_mapped": None,
+ "label": "trigger_dag_run_operator",
+ "tooltip": None,
+ "setup_teardown_type": None,
+ "type": "trigger",
+ "operator": None,
+ "asset_condition_type": None,
+ },
+ {
+ "children": None,
+ "id": "and-gate-0",
+ "is_mapped": None,
+ "label": "and-gate-0",
+ "tooltip": None,
+ "setup_teardown_type": None,
+ "type": "asset-condition",
+ "operator": None,
+ "asset_condition_type": "and-gate",
+ },
+ {
+ "children": None,
+ "id": "asset1",
+ "is_mapped": None,
+ "label": "asset1",
+ "tooltip": None,
+ "setup_teardown_type": None,
+ "type": "asset",
+ "operator": None,
+ "asset_condition_type": None,
+ },
+ {
+ "children": None,
+ "id": "asset2",
+ "is_mapped": None,
+ "label": "asset2",
+ "tooltip": None,
+ "setup_teardown_type": None,
+ "type": "asset",
+ "operator": None,
+ "asset_condition_type": None,
Review Comment:
thanks, this is wrong. rewrite the last part of structure
--
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]