@@ -310,68 +310,6 @@ def mock_exchange_id_token(id_token: oidc.IdToken):
310310class TestDatabricksCliTokenSourceArgs :
311311 """Tests that DatabricksCliTokenSource constructs correct CLI arguments."""
312312
313- def test_unified_host_passes_all_flags (self , mocker ):
314- """Unified host should pass --experimental-is-unified-host, --account-id, and --workspace-id."""
315- # Mock the parent class __init__ to capture the command arguments
316- mock_init = mocker .patch .object (
317- credentials_provider .CliTokenSource ,
318- "__init__" ,
319- return_value = None ,
320- )
321-
322- mock_cfg = Mock ()
323- mock_cfg .profile = None
324- mock_cfg .host = "https://example.databricks.com"
325- mock_cfg .experimental_is_unified_host = True
326- mock_cfg .account_id = "test-account-id"
327- mock_cfg .workspace_id = 12345
328- mock_cfg .databricks_cli_path = "/path/to/databricks"
329- mock_cfg .disable_async_token_refresh = False
330-
331- credentials_provider .DatabricksCliTokenSource (mock_cfg )
332-
333- # Verify the command was constructed correctly
334- call_kwargs = mock_init .call_args
335- cmd = call_kwargs .kwargs ["cmd" ]
336-
337- assert cmd [0 ] == "/path/to/databricks"
338- assert "auth" in cmd
339- assert "token" in cmd
340- assert "--host" in cmd
341- assert "https://example.databricks.com" in cmd
342- assert "--experimental-is-unified-host" in cmd
343- assert "--account-id" in cmd
344- assert "test-account-id" in cmd
345- assert "--workspace-id" in cmd
346- assert "12345" in cmd
347-
348- def test_unified_host_without_workspace_id (self , mocker ):
349- """Unified host without workspace_id should only pass --experimental-is-unified-host and --account-id."""
350- mock_init = mocker .patch .object (
351- credentials_provider .CliTokenSource ,
352- "__init__" ,
353- return_value = None ,
354- )
355-
356- mock_cfg = Mock ()
357- mock_cfg .profile = None
358- mock_cfg .host = "https://example.databricks.com"
359- mock_cfg .experimental_is_unified_host = True
360- mock_cfg .account_id = "test-account-id"
361- mock_cfg .workspace_id = None
362- mock_cfg .databricks_cli_path = "/path/to/databricks"
363- mock_cfg .disable_async_token_refresh = False
364-
365- credentials_provider .DatabricksCliTokenSource (mock_cfg )
366-
367- call_kwargs = mock_init .call_args
368- cmd = call_kwargs .kwargs ["cmd" ]
369-
370- assert "--experimental-is-unified-host" in cmd
371- assert "--account-id" in cmd
372- assert "test-account-id" in cmd
373- assert "--workspace-id" not in cmd
374-
375313 def test_account_client_passes_account_id (self , mocker ):
376314 """Non-unified account client should pass --account-id."""
377315 mock_init = mocker .patch .object (
0 commit comments