When the token is used in the databricks connection, the host name is being pulled from extra json data

https://github.com/apache/airflow/blob/fdd9b6f65b608c516b8a062b058972d9a45ec9e3/airflow/providers/databricks/hooks/databricks.py#L160


I think the host name should be pulled from databricks_conn directly as the line 164, where basic auth is being used https://github.com/apache/airflow/blob/fdd9b6f65b608c516b8a062b058972d9a45ec9e3/airflow/providers/databricks/hooks/databricks.py#L164

Thanks!

Liusong


tests/providers/databricks/hooks/test_databricks.py
"""
    Tests for DatabricksHook when auth is done with token.
    """
    @provide_session
    def setUp(self, session=None):
        conn = session.query(Connection).filter(Connection.conn_id == DEFAULT_CONN_ID).first()
        conn.extra = json.dumps({'token': TOKEN, 'host': HOST})
        session.commit()
        self.hook = DatabricksHook()
    @mock.patch('airflow.providers.databricks.hooks.databricks.requests')
    def test_submit_run(self, mock_requests):
        mock_requests.codes.ok = 200
        mock_requests.post.return_value.json.return_value = {'run_id': '1'}
        status_code_mock = mock.PropertyMock(return_value=200)
        type(mock_requests.post.return_value).status_code = status_code_mock
        data = {'notebook_task': NOTEBOOK_TASK, 'new_cluster': NEW_CLUSTER}
        run_id = self.hook.submit_run(data)
        self.assertEqual(run_id, '1')
        args = mock_requests.post.call_args
        kwargs = args[1]
        self.assertEqual(kwargs['auth'].token, TOKEN)
class TestRunState(unittest.TestCase):