|
23 | 23 | from unittest.mock import patch
|
24 | 24 |
|
25 | 25 | import pytest
|
26 |
| -from azure.kusto.data.request import ClientRequestProperties, KustoClient, KustoConnectionStringBuilder |
| 26 | +from azure.kusto.data import ClientRequestProperties, KustoClient, KustoConnectionStringBuilder |
27 | 27 | from pytest import param
|
28 | 28 |
|
29 | 29 | from airflow.exceptions import AirflowException
|
@@ -225,21 +225,23 @@ def test_get_ui_field_behaviour_placeholders(self):
|
225 | 225 | param("a://usr:pw@host?tenant=my-tenant&auth_method=AAD_APP", id="no-prefix"),
|
226 | 226 | ],
|
227 | 227 | )
|
228 |
| - @patch("airflow.providers.microsoft.azure.hooks.adx.KustoConnectionStringBuilder") |
229 |
| - def test_backcompat_prefix_works(self, mock_client, uri): |
230 |
| - mock_with = mock_client.with_aad_application_key_authentication |
| 228 | + def test_backcompat_prefix_works(self, uri): |
231 | 229 | with patch.dict(os.environ, AIRFLOW_CONN_MY_CONN=uri):
|
232 |
| - AzureDataExplorerHook(azure_data_explorer_conn_id="my_conn") # get_conn is called in init |
233 |
| - mock_with.assert_called_once_with("host", "usr", "pw", "my-tenant") |
| 230 | + hook = AzureDataExplorerHook(azure_data_explorer_conn_id="my_conn") # get_conn is called in init |
| 231 | + assert hook.connection._kcsb.data_source == "host" |
| 232 | + assert hook.connection._kcsb.application_client_id == "usr" |
| 233 | + assert hook.connection._kcsb.application_key == "pw" |
| 234 | + assert hook.connection._kcsb.authority_id == "my-tenant" |
234 | 235 |
|
235 |
| - @patch("airflow.providers.microsoft.azure.hooks.adx.KustoConnectionStringBuilder") |
236 |
| - def test_backcompat_prefix_both_causes_warning(self, mock_client): |
237 |
| - mock_with = mock_client.with_aad_application_key_authentication |
| 236 | + def test_backcompat_prefix_both_causes_warning(self): |
238 | 237 | with patch.dict(
|
239 | 238 | in_dict=os.environ,
|
240 | 239 | AIRFLOW_CONN_MY_CONN="a://usr:pw@host?tenant=my-tenant&auth_method=AAD_APP"
|
241 | 240 | "&extra__azure_data_explorer__auth_method=AAD_APP",
|
242 | 241 | ):
|
243 | 242 | with pytest.warns(Warning, match="Using value for `auth_method`"):
|
244 |
| - AzureDataExplorerHook(azure_data_explorer_conn_id="my_conn") # get_conn is called in init |
245 |
| - mock_with.assert_called_once_with("host", "usr", "pw", "my-tenant") |
| 243 | + hook = AzureDataExplorerHook(azure_data_explorer_conn_id="my_conn") |
| 244 | + assert hook.connection._kcsb.data_source == "host" |
| 245 | + assert hook.connection._kcsb.application_client_id == "usr" |
| 246 | + assert hook.connection._kcsb.application_key == "pw" |
| 247 | + assert hook.connection._kcsb.authority_id == "my-tenant" |
0 commit comments