eladkal commented on code in PR #54652:
URL: https://github.com/apache/airflow/pull/54652#discussion_r2362936298


##########
airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_assets.py:
##########
@@ -74,3 +76,85 @@ def test_should_respond_401(self, 
unauthenticated_test_client):
     def test_should_respond_403(self, unauthorized_test_client):
         response = unauthorized_test_client.get("/next_run_assets/upstream")
         assert response.status_code == 403
+
+    def test_should_set_last_update_only_for_queued_and_hide_flag(self, 
test_client, dag_maker, session):
+        with dag_maker(
+            dag_id="two_assets_equal",
+            schedule=[
+                Asset(uri="s3://bucket/A", name="A"),
+                Asset(uri="s3://bucket/B", name="B"),
+            ],
+            serialized=True,
+        ):
+            EmptyOperator(task_id="t")
+
+        dr = dag_maker.create_dagrun()
+        dag_maker.sync_dagbag_to_db()
+
+        assets = {
+            a.uri: a
+            for a in 
session.query(AssetModel).filter(AssetModel.uri.in_(["s3://bucket/A", 
"s3://bucket/B"]))
+        }
+        # Queue and add an event only for A
+        session.add(AssetDagRunQueue(asset_id=assets["s3://bucket/A"].id, 
target_dag_id="two_assets_equal"))
+        session.add(
+            AssetEvent(asset_id=assets["s3://bucket/A"].id, 
timestamp=dr.logical_date or pendulum.now())
+        )
+        session.commit()
+
+        response = test_client.get("/next_run_assets/two_assets_equal")
+        assert response.status_code == 200
+        assert response.json() == {
+            "asset_expression": {
+                "all": [
+                    {
+                        "asset": {
+                            "uri": "s3://bucket/A",
+                            "name": "A",
+                            "group": "asset",
+                            "id": mock.ANY,
+                        }
+                    },
+                    {
+                        "asset": {
+                            "uri": "s3://bucket/B",
+                            "name": "B",
+                            "group": "asset",
+                            "id": mock.ANY,
+                        }
+                    },
+                ]
+            },
+            # events are ordered by uri
+            "events": [
+                {"id": mock.ANY, "uri": "s3://bucket/A", "name": "A", 
"lastUpdate": mock.ANY},
+                {"id": mock.ANY, "uri": "s3://bucket/B", "name": "B", 
"lastUpdate": None},
+            ],
+        }
+
+

Review Comment:
   ```suggestion
   ```



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