This is an automated email from the ASF dual-hosted git repository.
amoghdesai pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new ff219fead12 Expanding task sdk integration tests to test asset
operations (#58028)
ff219fead12 is described below
commit ff219fead12cef144df0082a50847bfa58b752f1
Author: Amogh Desai <[email protected]>
AuthorDate: Sat Nov 8 20:25:55 2025 +0530
Expanding task sdk integration tests to test asset operations (#58028)
---
.../task_sdk_tests/test_asset_event_operations.py | 66 ++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/task-sdk-tests/tests/task_sdk_tests/test_asset_event_operations.py
b/task-sdk-tests/tests/task_sdk_tests/test_asset_event_operations.py
new file mode 100644
index 00000000000..e02e569149d
--- /dev/null
+++ b/task-sdk-tests/tests/task_sdk_tests/test_asset_event_operations.py
@@ -0,0 +1,66 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""
+Integration tests for Asset Event operations.
+
+These tests validate the Execution API endpoints for Asset Event operations:
+- get(): Get asset events by name or URI
+"""
+
+from __future__ import annotations
+
+from airflow.sdk.api.datamodels._generated import AssetEventsResponse
+from task_sdk_tests import console
+
+
+def test_asset_event_get(sdk_client_for_assets, asset_test_setup):
+ """Test getting asset events by name."""
+ console.print("[yellow]Getting asset events by name...")
+
+ response =
sdk_client_for_assets.asset_events.get(name=asset_test_setup["name"])
+
+ console.print(" Asset Event Get Response ".center(72, "="))
+ console.print(f"[bright_blue]Response Type:[/] {type(response).__name__}")
+ console.print(f"[bright_blue]Number of Events:[/]
{len(response.asset_events)}")
+ assert isinstance(response, AssetEventsResponse)
+ assert len(response.asset_events) >= 1
+ event = response.asset_events[0]
+ console.print(f"[bright_blue]First Event ID:[/] {event.id}")
+ console.print(f"[bright_blue]First Event Asset Name:[/]
{event.asset.name}")
+ console.print(f"[bright_blue]First Event Asset URI:[/] {event.asset.uri}")
+ console.print(f"[bright_blue]First Event Timestamp:[/] {event.timestamp}")
+ console.print("=" * 72)
+ assert event.asset.name == asset_test_setup["name"]
+ assert event.asset.uri == asset_test_setup["uri"]
+
+ console.print("[green]✅ Asset event get test passed!")
+
+
+def test_asset_event_get_not_found(sdk_client_for_assets):
+ """Test getting asset events for non-existent asset."""
+ console.print("[yellow]Getting asset events for non-existent asset...")
+
+ response =
sdk_client_for_assets.asset_events.get(name="non_existent_asset_name")
+
+ console.print(" Asset Event Get (Not Found) Response ".center(72, "="))
+ console.print(f"[bright_blue]Response Type:[/] {type(response).__name__}")
+ console.print(f"[bright_blue]Number of Events:[/]
{len(response.asset_events)}")
+ console.print("=" * 72)
+
+ assert isinstance(response, AssetEventsResponse)
+ assert len(response.asset_events) == 0, "Expected empty list for
non-existent asset"
+ console.print("[green]✅ Asset event get (not found) test passed!")