Coverage for mindsdb / integrations / handlers / matrixone_handler / tests / test_matrixone_handler.py: 0%

33 statements  

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

1import unittest 

2 

3from mindsdb.integrations.handlers.matrixone_handler.matrixone_handler import MatrixOneHandler 

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

5 

6 

7class MatrixOneHandlerTest(unittest.TestCase): 

8 @classmethod 

9 def setUpClass(cls): 

10 cls.kwargs = { 

11 "connection_data": { 

12 "host": "localhost", 

13 "port": 6001, 

14 "user": "dump", 

15 "password": "111", 

16 "database": "mo_catalog", 

17 "ssl": False 

18 } 

19 } 

20 cls.handler = MatrixOneHandler('test_mysql_handler', cls.kwargs) 

21 

22 def test_0_connect(self): 

23 self.handler.connect() 

24 

25 def test_1_drop_table(self): 

26 res = self.handler.query("DROP TABLE IF EXISTS PREM;") 

27 assert res.type is not RESPONSE_TYPE.ERROR 

28 

29 def test_2_create_table(self): 

30 res = self.handler.query("CREATE TABLE IF NOT EXISTS PREM (Premi varchar(50));") 

31 assert res.type is not RESPONSE_TYPE.ERROR 

32 

33 def test_3_insert_table(self): 

34 res = self.handler.query("INSERT INTO PREM VALUES('Radha <3 Krishna');") 

35 assert res.type is not RESPONSE_TYPE.ERROR 

36 

37 def test_4_get_tables(self): 

38 tables = self.handler.get_tables() 

39 assert tables.type is not RESPONSE_TYPE.ERROR 

40 

41 def test_5_select_query(self): 

42 query = "SELECT * FROM PREM;" 

43 result = self.handler.native_query(query) 

44 assert result.type is not RESPONSE_TYPE.ERROR 

45 

46 def test_6_get_columns(self): 

47 result = self.handler.get_columns('PREM') 

48 assert result.type is not RESPONSE_TYPE.ERROR 

49 

50 def test_7_check_connection(self): 

51 self.handler.check_connection() 

52 

53 

54if __name__ == '__main__': 

55 unittest.main()