This is an automated email from the ASF dual-hosted git repository.

dabla 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 bbcfbe25f1e Keep MSGraph request configuration across paginated pages 
(#71649)
bbcfbe25f1e is described below

commit bbcfbe25f1e1b648036f489ee46eb7e20a736dbb
Author: Sepuri Sai Krishna <[email protected]>
AuthorDate: Mon Aug 17 11:42:54 2026 +0530

    Keep MSGraph request configuration across paginated pages (#71649)
---
 .../providers/microsoft/azure/operators/msgraph.py |  3 ++
 .../unit/microsoft/azure/operators/test_msgraph.py | 51 ++++++++++++++++++++++
 2 files changed, 54 insertions(+)

diff --git 
a/providers/microsoft/azure/src/airflow/providers/microsoft/azure/operators/msgraph.py
 
b/providers/microsoft/azure/src/airflow/providers/microsoft/azure/operators/msgraph.py
index 7399afbe4b2..7cd68b64706 100644
--- 
a/providers/microsoft/azure/src/airflow/providers/microsoft/azure/operators/msgraph.py
+++ 
b/providers/microsoft/azure/src/airflow/providers/microsoft/azure/operators/msgraph.py
@@ -342,10 +342,13 @@ class MSGraphAsyncOperator(BaseOperator):
                         url=url,
                         method=self.method,
                         query_parameters=query_parameters,
+                        headers=self.headers,
+                        data=self.data,
                         response_type=self.response_type,
                         conn_id=self.conn_id,
                         timeout=self.timeout,
                         proxies=self.proxies,
+                        scopes=self.scopes,
                         api_version=self.api_version,
                         serializer=type(self.serializer),
                     ),
diff --git 
a/providers/microsoft/azure/tests/unit/microsoft/azure/operators/test_msgraph.py
 
b/providers/microsoft/azure/tests/unit/microsoft/azure/operators/test_msgraph.py
index 08c921aaace..b722bc4a617 100644
--- 
a/providers/microsoft/azure/tests/unit/microsoft/azure/operators/test_msgraph.py
+++ 
b/providers/microsoft/azure/tests/unit/microsoft/azure/operators/test_msgraph.py
@@ -22,6 +22,7 @@ import warnings
 from base64 import b64encode
 from os.path import dirname
 from typing import Any
+from unittest import mock
 
 import pytest
 
@@ -318,6 +319,56 @@ class TestMSGraphAsyncOperator:
         assert url == "users"
         assert query_parameters == {"$skip": 12, "$top": 12}
 
+    def test_trigger_next_link_forwards_the_request_configuration(self):
+        headers = {"ConsistencyLevel": "eventual"}
+        data = {"requestBody": "value"}
+        scopes = ["https://graph.microsoft.com/.default";]
+        operator = MSGraphAsyncOperator(
+            task_id="user_license_details",
+            conn_id="msgraph_api",
+            url="users",
+            headers=headers,
+            data=data,
+            scopes=scopes,
+        )
+        context = mock_context(task=operator)
+        response = load_json_from_resources(dirname(__file__), "..", 
"resources", "users.json")
+
+        with mock.patch.object(operator, "defer") as mock_defer:
+            operator.trigger_next_link(response, 
method_name="execute_complete", context=context)
+
+        trigger = mock_defer.call_args.kwargs["trigger"]
+        assert trigger.headers == headers
+        assert trigger.data == data
+        assert trigger.scopes == scopes
+
+    def test_pagination_issues_every_page_with_the_configured_request(self):
+        users = load_json_from_resources(dirname(__file__), "..", "resources", 
"users.json")
+        next_users = load_json_from_resources(dirname(__file__), "..", 
"resources", "next_users.json")
+        response = mock_json_response(200, users, next_users)
+        headers = {"ConsistencyLevel": "eventual"}
+        data = {"requestBody": "value"}
+
+        with patch_hook_and_request_adapter(response) as (*_, 
mock_get_http_response):
+            operator = MSGraphAsyncOperator(
+                task_id="users_delta",
+                conn_id="msgraph_api",
+                url="users",
+                method="POST",
+                headers=headers,
+                data=data,
+                result_processor=lambda result, **context: result.get("value"),
+            )
+
+            execute_operator(operator)
+
+        requests = [call.args[0] for call in 
mock_get_http_response.call_args_list]
+
+        assert len(requests) == 2
+        for request in requests:
+            assert request.headers.try_get("ConsistencyLevel") == {"eventual"}
+            assert request.content == json.dumps(data).encode("utf-8")
+
     def test_execute_callable(self):
         with pytest.warns(
             AirflowProviderDeprecationWarning,

Reply via email to