Coverage for mindsdb / integrations / handlers / singlestore_handler / tests / test_singlestore_handler.py: 0%

26 statements  

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

1import unittest 

2 

3from mindsdb.integrations.handlers.mysql_handler.mysql_handler import MySQLHandler 

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

5 

6 

7class MySQLHandlerTest(unittest.TestCase): 

8 @classmethod 

9 def setUpClass(cls): 

10 cls.kwargs = { 

11 "host": "localhost", 

12 "port": "3306", 

13 "user": "root", 

14 "password": "", 

15 "database": "test", 

16 "ssl": False 

17 } 

18 cls.handler = MySQLHandler('test_singlestore_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_mdb") 

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_mdb (test_col INT)") 

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

38 

39 def test_7_select_query(self): 

40 query = "SELECT * FROM test_mdb WHERE 'id'='a'" 

41 result = self.handler.native_query(query) 

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