mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
feat(SIP-95): permissions for catalogs (#28317)
This commit is contained in:
@@ -175,3 +175,33 @@ SELECT * FROM some_table;
|
||||
str(excinfo.value)
|
||||
== "Users are not allowed to set a search path for security reasons."
|
||||
)
|
||||
|
||||
|
||||
def test_adjust_engine_params() -> None:
|
||||
"""
|
||||
Test `adjust_engine_params`.
|
||||
|
||||
The method can be used to adjust the catalog (database) dynamically.
|
||||
"""
|
||||
from superset.db_engine_specs.postgres import PostgresEngineSpec
|
||||
|
||||
adjusted = PostgresEngineSpec.adjust_engine_params(
|
||||
make_url("postgresql://user:password@host:5432/dev"),
|
||||
{},
|
||||
catalog="prod",
|
||||
)
|
||||
assert adjusted == (make_url("postgresql://user:password@host:5432/prod"), {})
|
||||
|
||||
|
||||
def test_get_default_catalog() -> None:
|
||||
"""
|
||||
Test `get_default_catalog`.
|
||||
"""
|
||||
from superset.db_engine_specs.postgres import PostgresEngineSpec
|
||||
from superset.models.core import Database
|
||||
|
||||
database = Database(
|
||||
database_name="postgres",
|
||||
sqlalchemy_uri="postgresql://user:password@host:5432/dev",
|
||||
)
|
||||
assert PostgresEngineSpec.get_default_catalog(database) == "dev"
|
||||
|
||||
Reference in New Issue
Block a user