Coverage for mindsdb / integrations / handlers / impala_handler / tests / test_impala_handler.py: 0%

32 statements  

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

1import unittest 

2from mindsdb.integrations.handlers.impala_handler.impala_handler import ImpalaHandler 

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

4 

5 

6class ImpalaHandlerTest(unittest.TestCase): 

7 @classmethod 

8 def setUpClass(cls): 

9 cls.kwargs = { 

10 'user': '<UID>', 

11 'password': '<P455w0rd>', 

12 'host': '127.0.0.1', 

13 'port': 21050, 

14 'database': 'temp' 

15 

16 } 

17 cls.handler = ImpalaHandler('test_impala_handler', **cls.kwargs) 

18 

19 def test_0_check_connection(self): 

20 assert self.handler.check_connection() 

21 

22 def test_1_connect(self): 

23 assert self.handler.connect() 

24 

25 def test_2_create_table(self): 

26 query = "CREATE Table Car(Name Varchar, Price Integer);" 

27 result = self.handler.query(query) 

28 assert result.type is not RESPONSE_TYPE.ERROR 

29 

30 def test_3_insert(self): 

31 query = "INSERT INTO Car ('Tata SUV', 860000)" 

32 result = self.handler.query(query) 

33 assert result.type is not RESPONSE_TYPE.ERROR 

34 

35 def test_4_native_query_select(self): 

36 query = "SELECT * FROM Car;" 

37 result = self.handler.query(query) 

38 assert result.type is RESPONSE_TYPE.TABLE 

39 

40 def test_5_get_tables(self): 

41 tables = self.handler.get_tables() 

42 assert tables.type is RESPONSE_TYPE.TABLE 

43 

44 def test_6_get_columns(self): 

45 columns = self.handler.get_columns('Car') 

46 assert columns.type is not RESPONSE_TYPE.ERROR 

47 

48 

49if __name__ == '__main__': 

50 unittest.main()