Coverage for mindsdb / integrations / handlers / maxdb_handler / tests / test_maxdb_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.maxdb_handler.maxdb_handler import MaxDBHandler 

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

5 

6 

7class SurrealdbHandlerTest(unittest.TestCase): 

8 @classmethod 

9 def setUpClass(cls): 

10 cls.kwargs = { 

11 "connection_data": { 

12 "host": "127.0.0.1", 

13 "port": "7210", 

14 "user": "MAXDB", 

15 "password": "password", 

16 "database": "MAXDB", 

17 "jdbc_location": "/path/to/jdbc/sapdbc.jar" 

18 } 

19 } 

20 cls.handler = MaxDBHandler('test_maxdb_handler', **cls.kwargs) 

21 

22 def test_0_check_connection(self): 

23 assert self.handler.check_connection() 

24 

25 def test_1_create_table(self): 

26 res = self.handler.native_query("CREATE TABLE TEST_TABLE (id INT PRIMARY KEY,name VARCHAR(50))") 

27 assert res.type is not RESPONSE_TYPE.ERROR 

28 

29 def test_2_insert(self): 

30 res = self.handler.native_query("INSERT INTO TEST_TABLE (id, name) VALUES (1, 'MARSID')") 

31 assert res.type is not RESPONSE_TYPE.ERROR 

32 

33 def test_3_select_query(self): 

34 query = "SELECT * FROM TEST_TABLE" 

35 result = self.handler.native_query(query) 

36 assert result.type is RESPONSE_TYPE.TABLE 

37 

38 def test_4_get_columns(self): 

39 columns = self.handler.get_columns('TEST_TABLE') 

40 assert columns.type is not RESPONSE_TYPE.ERROR 

41 

42 def test_5_get_tables(self): 

43 tables = self.handler.get_tables() 

44 assert tables.type is not RESPONSE_TYPE.ERROR 

45 

46 def test_6_drop_table(self): 

47 res = self.handler.native_query("DROP TABLE TEST_TABLE") 

48 assert res.type is not RESPONSE_TYPE.ERROR 

49 

50 def test_7_disconnect(self): 

51 assert self.handler.disconnect() is None 

52 

53 

54if __name__ == '__main__': 

55 unittest.main()