Coverage for mindsdb / integrations / handlers / databricks_handler / tests / test_databricks_handler.py: 0%

22 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-01-21 00:36 +0000

1import unittest 

2from mindsdb.integrations.handlers.databricks_handler.databricks_handler import ( 

3 DatabricksHandler, 

4) 

5from mindsdb.api.executor.data_types.response_type import RESPONSE_TYPE 

6 

7 

8class DatabricksHandlerTest(unittest.TestCase): 

9 @classmethod 

10 def setUpClass(cls): 

11 cls.kwargs = { 

12 "server_hostname": "adb-1234567890123456.7.azuredatabricks.net", 

13 "http_path": "sql/protocolv1/o/1234567890123456/1234-567890-test123", 

14 "access_token": "dapi1234567890ab1cde2f3ab456c7d89efa", 

15 "schema": "sales", 

16 } 

17 cls.handler = DatabricksHandler("test_databricks_handler", cls.kwargs) 

18 

19 def test_0_check_connection(self): 

20 assert self.handler.check_connection() 

21 

22 def test_1_native_query_select(self): 

23 query = "SELECT * FROM sales_features" 

24 result = self.handler.native_query(query) 

25 assert result.type is RESPONSE_TYPE.TABLE 

26 

27 def test_2_get_tables(self): 

28 tables = self.handler.get_tables() 

29 assert tables.type is not RESPONSE_TYPE.ERROR 

30 

31 def test_4_get_columns(self): 

32 columns = self.handler.get_columns("sales_features") 

33 assert columns.type is not RESPONSE_TYPE.ERROR 

34 

35 

36if __name__ == "__main__": 

37 unittest.main()