pierrejeambrun commented on code in PR #47381:
URL: https://github.com/apache/airflow/pull/47381#discussion_r2005712494


##########
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):

Review Comment:
   Why did we separate out this test case ? We need an extra `asset3_id` ?



##########
tests/utils/test_dot_renderer.py:
##########
@@ -51,19 +51,26 @@ def teardown_method(self):
 
     def test_should_render_dag_dependencies(self):
         dag_dep_1 = DagDependency(
-            source="dag_one", target="dag_two", dependency_type="Sensor", 
dependency_id="task_1"
+            source="dag_one",
+            target="dag_two",
+            label="task_1",
+            dependency_type="sensor",
+            dependency_id="task_1",
         )
         dag_dep_2 = DagDependency(
-            source="dag_two", target="dag_three", dependency_type="Sensor", 
dependency_id="task_2"
+            source="dag_two",
+            target="dag_three",
+            label="task_2",
+            dependency_type="sensor",
+            dependency_id="task_2",
         )
 
-        dag_dependency_list = []
-        dag_dependency_list.append(dag_dep_1)
-        dag_dependency_list.append(dag_dep_2)
+        dag_dependency_list = [dag_dep_1, dag_dep_2]
 
         dag_dependency_dict = {}
         dag_dependency_dict["dag_one"] = dag_dependency_list
         dot = dot_renderer.render_dag_dependencies(dag_dependency_dict)
+        # breakpoint()

Review Comment:
   to remove



##########
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:
   Why do asset 1 and asset 2 have not the same structure as the asset 3 ? (we 
are missing the asset id in the `"id"` etc.)? 
   



-- 
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