Coverage for mindsdb / integrations / handlers / clickhouse_handler / tests / test_clickhouse_handler.py: 0%
27 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-21 00:36 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-21 00:36 +0000
1import unittest
2from mindsdb.integrations.handlers.clickhouse_handler.clickhouse_handler import ClickHouseHandler
3from mindsdb.api.executor.data_types.response_type import RESPONSE_TYPE
6class PostgresHandlerTest(unittest.TestCase):
7 @classmethod
8 def setUpClass(cls):
9 connection_data = {
10 "host": "localhost",
11 "port": "9000",
12 "user": "root",
13 "password": "pass",
14 "database": "test_data"
15 }
16 cls.handler = ClickHouseHandler('test_clickhouse_handler', connection_data)
18 def test_0_check_connection(self):
19 assert self.handler.check_connection()
21 def test_1_native_query_show_dbs(self):
22 result = self.handler.native_query("SHOW DATABASES;")
23 assert result.type is not RESPONSE_TYPE.ERROR
25 def test_2_wrong_native_query_returns_error(self):
26 result = self.handler.native_query("SHOW DATABASE1S;")
27 assert result.type is RESPONSE_TYPE.ERROR
29 def test_3_select_query(self):
30 query = 'SELECT * FROM hdi'
31 result = self.handler.query(query)
32 assert result.type is RESPONSE_TYPE.TABLE
34 def test_4_get_tables(self):
35 tbls = self.handler.get_tables()
36 assert tbls.type is not RESPONSE_TYPE.ERROR
38 def test_5_describe_table(self):
39 described = self.handler.get_columns("hdi")
40 print('described', described)
41 assert described.type is RESPONSE_TYPE.TABLE