amoghrajesh commented on code in PR #61493:
URL: https://github.com/apache/airflow/pull/61493#discussion_r2772669764
##########
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_xcom.py:
##########
@@ -1,3 +1,33 @@
+ def test_patch_xcom_entry_api(self, test_client, session):
+ """Test PATCH endpoint updates XCom value and returns full updated
object."""
+ dag_id = "test_dag"
+ task_id = "test_task"
+ run_id = "test_run"
+ xcom_key = "test_key"
+ map_index = -1
+ initial_value = {"foo": "bar"}
+ updated_value = {"foo": "baz"}
+
+ # Create initial XCom entry
+ response = test_client.post(
+
f"/dags/{dag_id}/dagRuns/{run_id}/taskInstances/{task_id}/xcomEntries",
+ json={"key": xcom_key, "value": initial_value, "map_index":
map_index},
+ )
+ assert response.status_code == 201
+
+ # PATCH to update the value
+ patch_response = test_client.patch(
+
f"/dags/{dag_id}/dagRuns/{run_id}/taskInstances/{task_id}/xcomEntries/{xcom_key}",
+ json={"value": updated_value, "map_index": map_index},
+ )
+ assert patch_response.status_code == 200
+ patch_data = patch_response.json()
+ # Value should be serialized as JSON string
+ assert patch_data["value"] == json.dumps(updated_value)
+ assert patch_data["key"] == xcom_key
+ assert patch_data["task_id"] == task_id
+ assert patch_data["dag_id"] == dag_id
+ assert patch_data["run_id"] == run_id
Review Comment:
Formatting needs to be fixed, it cannot be added before license, request you
to follow
https://github.com/apache/airflow/blob/main/contributing-docs/README.rst
--
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]