Coverage for mindsdb / integrations / handlers / hive_handler / tests / test_hive_handler.py: 0%

31 statements  

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

1import unittest 

2 

3from mindsdb.integrations.handlers.hive_handler.hive_handler import HiveHandler 

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

5 

6 

7class HiveHandlerTest(unittest.TestCase): 

8 @classmethod 

9 def setUpClass(cls): 

10 cls.kwargs = { 

11 "host": "localhost", 

12 "port": "10000", 

13 "user": "admin", 

14 "password": "password", 

15 "database": "default", 

16 "auth": "CUSTOM" 

17 } 

18 cls.handler = HiveHandler('test_hive_handler', **cls.kwargs) 

19 

20 def test_0_connect(self): 

21 self.handler.check_connection() 

22 

23 def test_1_native_query_show_dbs(self): 

24 dbs = self.handler.native_query("SHOW DATABASES;") 

25 assert dbs['type'] is not RESPONSE_TYPE.ERROR 

26 

27 def test_2_get_tables(self): 

28 tbls = self.handler.get_tables() 

29 assert tbls['type'] is not RESPONSE_TYPE.ERROR 

30 

31 def test_5_drop_table(self): 

32 res = self.handler.native_query("DROP TABLE IF EXISTS test_hdb") 

33 assert res['type'] is not RESPONSE_TYPE.ERROR 

34 

35 def test_4_create_table(self): 

36 res = self.handler.native_query("CREATE TABLE IF NOT EXISTS test_hdb (test_col INT)") 

37 assert res['type'] is not RESPONSE_TYPE.ERROR 

38 

39 def test_6_describe_table(self): 

40 described = self.handler.get_columns("test_hdb") 

41 assert described['type'] is RESPONSE_TYPE.TABLE 

42 

43 def test_7_select_query(self): 

44 query = "SELECT * FROM test_mdb WHERE foo=238" 

45 result = self.handler.query(query) 

46 assert result['type'] is RESPONSE_TYPE.TABLE 

47 

48 

49if __name__ == '__main__': 

50 unittest.main()