hussein-awala commented on code in PR #74852:
URL: https://github.com/apache/airflow/pull/74852#discussion_r4407151710
##########
airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_asset_events.py:
##########
@@ -96,6 +101,52 @@ def test_asset_alias(session, test_asset_events,
test_asset):
class TestGetAssetEventByAsset:
+ @pytest.mark.parametrize("partition_key", [None, "2026-10-16"])
+ def test_get_watcher_event_through_task_sdk(self, client, session,
test_asset, partition_key, request):
+ trigger = Trigger(classpath="airflow.triggers.testing.SuccessTrigger",
kwargs={})
+ session.add(trigger)
+ session.flush()
+
+ def cleanup():
+ session.execute(delete(AssetEvent).where(AssetEvent.asset_id ==
test_asset.id))
+
session.execute(delete(AssetWatcherModel).where(AssetWatcherModel.trigger_id ==
trigger.id))
+ session.execute(delete(Trigger).where(Trigger.id == trigger.id))
+ session.commit()
+
+ request.addfinalizer(cleanup)
+ test_asset.add_trigger(trigger, "partition_watcher")
+ session.flush()
+ payload = {"partition_key": "payload-only", "changed": True}
+ event = (
+ TriggerEvent(payload)
+ if partition_key is None
+ else AssetTriggerEvent(payload, partition_key=partition_key)
Review Comment:
Why not `AssetTriggerEvent` with `partition_key=None`?
--
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]