BrianLii commented on code in PR #53217:
URL: https://github.com/apache/airflow/pull/53217#discussion_r2208176652


##########
providers/databricks/tests/unit/databricks/hooks/test_databricks_sql.py:
##########
@@ -107,6 +112,41 @@ def mock_timer():
         yield mock_timer
 
 
+def make_mock_connection():
+    return Connection(
+        conn_id=DEFAULT_CONN_ID,
+        conn_type="databricks",
+        host=HOST,
+        port=PORT,
+        login="token",
+        password=TOKEN,
+    )
+
+
+def test_sqlachemy_url_property(mock_get_conn):
+    mock_get_conn.return_value = make_mock_connection()
+    hook = DatabricksSqlHook(
+        databricks_conn_id=DEFAULT_CONN_ID, http_path=HTTP_PATH, 
catalog=CATALOG, schema=SCHEMA
+    )
+    url = hook.sqlalchemy_url.render_as_string(hide_password=False)
+    assert url.startswith(f"databricks://token:{TOKEN}@{HOST}:{PORT}")
+    assert f"http_path={quote_plus(HTTP_PATH)}" in url
+    assert f"catalog={CATALOG}" in url
+    assert f"schema={SCHEMA}" in url

Review Comment:
   > explicitly asserting the expected URL would make the test more readable 
and help ensure that the query parameters are correctly formatted.
   
   Got it. I went with this approach and have submitted the change.



-- 
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]

Reply via email to