datahub/metadata-ingestion/tests/unit/test_clickhouse_source.py
Aseem Bansal 61a95f41ae
chore: fix lint and remove incorrect integration mark from unit tests (#4621)
* chore: fix lint and remove incorrect integration mark from unit tests

* add to test requirements

* revert athena source tests
2022-04-08 17:18:48 +02:00

50 lines
1.2 KiB
Python

from datahub.ingestion.source.sql.clickhouse import ClickHouseConfig
def test_clickhouse_uri_https():
config = ClickHouseConfig.parse_obj(
{
"username": "user",
"password": "password",
"host_port": "host:1111",
"database": "db",
"protocol": "https",
}
)
assert (
config.get_sql_alchemy_url()
== "clickhouse://user:password@host:1111/db?protocol=https"
)
def test_clickhouse_uri_native():
config = ClickHouseConfig.parse_obj(
{
"username": "user",
"password": "password",
"host_port": "host:1111",
"scheme": "clickhouse+native",
}
)
assert config.get_sql_alchemy_url() == "clickhouse+native://user:password@host:1111"
def test_clickhouse_uri_native_secure():
config = ClickHouseConfig.parse_obj(
{
"username": "user",
"password": "password",
"host_port": "host:1111",
"database": "db",
"scheme": "clickhouse+native",
"secure": True,
}
)
assert (
config.get_sql_alchemy_url()
== "clickhouse+native://user:password@host:1111/db?secure=true"
)