Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Only quote the keys of the query_parameters in MSGraphOperator #39207

Merged
merged 5 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion airflow/providers/microsoft/azure/triggers/msgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def normalize_url(self) -> str | None:

def encoded_query_parameters(self) -> dict:
if self.query_parameters:
return {quote(key): quote(str(value)) for key, value in self.query_parameters.items()}
return {quote(key): value for key, value in self.query_parameters.items()}
return {}

def request_information(self) -> RequestInformation:
Expand Down
11 changes: 11 additions & 0 deletions tests/providers/microsoft/azure/triggers/test_msgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,17 @@ def test_template_fields(self):
for template_field in MSGraphTrigger.template_fields:
getattr(trigger, template_field)

def test_encoded_query_parameters(self):
trigger = MSGraphTrigger(
url="myorg/admin/groups",
conn_id="msgraph_api",
query_parameters={"$expand": "reports,users,datasets,dataflows,dashboards", "$top": 5000},
)

actual = trigger.encoded_query_parameters()

assert actual == {"%24expand": "reports,users,datasets,dataflows,dashboards", "%24top": 5000}


class TestResponseHandler:
def test_handle_response_async(self):
Expand Down