davidnzhang commented on code in PR #69014:
URL: https://github.com/apache/airflow/pull/69014#discussion_r3485754259
##########
providers/microsoft/azure/tests/unit/microsoft/azure/hooks/test_msgraph.py:
##########
@@ -570,6 +570,19 @@ async def
test_send_request_invalidates_cache_and_raises_on_any_error(self):
adapter.send_no_response_content_async.assert_called_once()
assert hook.conn_id not in hook.cached_request_adapters
+ @pytest.mark.asyncio
+ async def test_allowed_hosts_is_empty_list_when_not_configured(self):
+ """an unset allowed_hosts/authority must yield []."""
+ KiotaRequestAdapterHook.cached_request_adapters.clear()
+ with patch_hook():
+ with patch(
+
"airflow.providers.microsoft.azure.hooks.msgraph.AzureIdentityAuthenticationProvider"
+ ) as mock_auth_provider:
+ hook = KiotaRequestAdapterHook(conn_id="msgraph_api")
+ await hook.get_async_conn()
+
+ assert mock_auth_provider.call_args.kwargs["allowed_hosts"] ==
[]
Review Comment:
Thanks for the review - changed to lighter direct unit tests on the new
static method now that logic is moved out of `_build_request_adapter` (63f1456).
On the filtering test - I held off on a dedicated test case for
"host1,,host2,", as a blank host given alongside real hosts doesn't affect the
validator. It just needs the distinction between an empty list `[]` which will
hit this [early
return](https://github.com/microsoft/kiota-python/commit/8755f7026763e0cf30d13d01ac46f48fd26798ff#diff-e26d7f5896b4b10a85e1e8cc9bc3a5f7654f88d31ed067def7863e8dfb9f931dR60-R61)
block and a list with an empty string `[""]` which will evaluate to False in
the same block and proceed to host validation.
Happy to add the "," and "host1,,host2," if you think these are worth
pinning down explicitly.
--
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]