mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
feat: make user agent customizable (#32506)
This commit is contained in:
@@ -37,7 +37,7 @@ from trino.sqlalchemy import datatype
|
||||
from trino.sqlalchemy.dialect import TrinoDialect
|
||||
|
||||
import superset.config
|
||||
from superset.constants import QUERY_CANCEL_KEY, QUERY_EARLY_CANCEL_KEY, USER_AGENT
|
||||
from superset.constants import QUERY_CANCEL_KEY, QUERY_EARLY_CANCEL_KEY
|
||||
from superset.db_engine_specs.exceptions import (
|
||||
SupersetDBAPIConnectionError,
|
||||
SupersetDBAPIDatabaseError,
|
||||
@@ -81,7 +81,7 @@ def _assert_columns_equal(actual_cols, expected_cols) -> None:
|
||||
@pytest.mark.parametrize(
|
||||
"extra,expected",
|
||||
[
|
||||
({}, {"engine_params": {"connect_args": {"source": USER_AGENT}}}),
|
||||
({}, {"engine_params": {"connect_args": {"source": "Apache Superset"}}}),
|
||||
(
|
||||
{
|
||||
"first": 1,
|
||||
@@ -110,7 +110,7 @@ def test_get_extra_params(extra: dict[str, Any], expected: dict[str, Any]) -> No
|
||||
assert TrinoEngineSpec.get_extra_params(database) == expected
|
||||
|
||||
|
||||
@patch("superset.utils.core.create_ssl_cert_file")
|
||||
@patch("superset.db_engine_specs.trino.create_ssl_cert_file")
|
||||
def test_get_extra_params_with_server_cert(mock_create_ssl_cert_file: Mock) -> None:
|
||||
from superset.db_engine_specs.trino import TrinoEngineSpec
|
||||
|
||||
@@ -118,6 +118,7 @@ def test_get_extra_params_with_server_cert(mock_create_ssl_cert_file: Mock) -> N
|
||||
|
||||
database.extra = json.dumps({})
|
||||
database.server_cert = "TEST_CERT"
|
||||
database.db_engine_spec = TrinoEngineSpec
|
||||
mock_create_ssl_cert_file.return_value = "/path/to/tls.crt"
|
||||
extra = TrinoEngineSpec.get_extra_params(database)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user