villebro commented on code in PR #31580:
URL: https://github.com/apache/superset/pull/31580#discussion_r1894293237
##########
tests/unit_tests/db_engine_specs/test_doris.py:
##########
@@ -85,25 +86,25 @@ def test_get_column_spec(
(
"doris://user:password@host/db1",
{"param1": "some_value"},
- "db1",
+ "internal.information_schema",
Review Comment:
Is this a breaking change? To me it seems `db1` is indeed the database, not
`internal.information_schema`?
##########
tests/unit_tests/db_engine_specs/test_doris.py:
##########
@@ -120,6 +121,11 @@ def test_adjust_engine_params(
returned_url, returned_connect_args = DorisEngineSpec.adjust_engine_params(
url, connect_args
)
+ # # Update expected schema to include .information_schema
+ # if return_schema not in ".":
+ # expected_schema = f"{return_schema}.information_schema"
+ # else:
+ # expected_schema = return_schema
Review Comment:
Why is this commented out block included here?
##########
tests/unit_tests/db_engine_specs/test_doris.py:
##########
@@ -145,3 +151,52 @@ def test_get_schema_from_engine_params() -> None:
)
is None
)
+
+
+def test_get_default_catalog() -> None:
+ """
+ Test the ``get_default_catalog`` method.
+ """
+ from superset.db_engine_specs.doris import DorisEngineSpec
+ from superset.models.core import Database
+
+ database = Mock(spec=Database)
+
+ # Test with catalog.schema format
+ database.url_object.database = "catalog1.schema1"
+ assert DorisEngineSpec.get_default_catalog(database) == "catalog1"
+
+ # Test with only catalog format
+ database.url_object.database = "catalog1"
+ assert DorisEngineSpec.get_default_catalog(database) == "catalog1"
+
+ # Test with None
+ database.url_object.database = None
+ assert DorisEngineSpec.get_default_catalog(database) is None
Review Comment:
Could we parametrize this test with `pytest.mark.parametrize`?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]