This is an automated email from the ASF dual-hosted git repository.
potiuk 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 9b538b7ab7 Fix azure-identity 1.15.0 api change (#35209)
9b538b7ab7 is described below
commit 9b538b7ab79cd840e201025fc051e5bfd71f6ec9
Author: Jarek Potiuk <[email protected]>
AuthorDate: Thu Oct 26 22:52:13 2023 +0200
Fix azure-identity 1.15.0 api change (#35209)
The azure-identity 1.15.0 introduced a change in the API call of
the secret credential and started to fail our tests. This PR adds
conditional test behaviour depending on the azure-identity version.
---
tests/providers/microsoft/azure/hooks/test_adx.py | 25 +++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/tests/providers/microsoft/azure/hooks/test_adx.py
b/tests/providers/microsoft/azure/hooks/test_adx.py
index 3dc696b83d..646f80c1bf 100644
--- a/tests/providers/microsoft/azure/hooks/test_adx.py
+++ b/tests/providers/microsoft/azure/hooks/test_adx.py
@@ -21,6 +21,7 @@ from unittest import mock
import pytest
from azure.kusto.data import ClientRequestProperties, KustoClient,
KustoConnectionStringBuilder
+from packaging.version import Version
from airflow.exceptions import AirflowException
from airflow.models import Connection
@@ -142,12 +143,24 @@ class TestAzureDataExplorerHook:
monkeypatch.setenv("AZURE_CLIENT_SECRET", "secret")
assert hook.connection._kcsb.data_source ==
"https://help.kusto.windows.net"
- mock1.assert_called_once_with(
- tenant_id="tenant",
- client_id="client",
- client_secret="secret",
- authority="https://login.microsoftonline.com",
- )
+ import azure.identity
+
+ azure_identity_version = Version(azure.identity.__version__)
+ if azure_identity_version >= Version("1.15.0"):
+ mock1.assert_called_once_with(
+ tenant_id="tenant",
+ client_id="client",
+ client_secret="secret",
+ authority="https://login.microsoftonline.com",
+ _within_dac=True,
+ )
+ else:
+ mock1.assert_called_once_with(
+ tenant_id="tenant",
+ client_id="client",
+ client_secret="secret",
+ authority="https://login.microsoftonline.com",
+ )
@pytest.mark.parametrize(
"mocked_connection",