Coverage for mindsdb / integrations / handlers / yugabyte_handler / tests / test_yugabyte_handler.py: 0%
30 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-21 00:36 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-21 00:36 +0000
1import unittest
2from mindsdb.integrations.handlers.yugabyte_handler.yugabyte_handler import YugabyteHandler
3from mindsdb.api.executor.data_types.response_type import RESPONSE_TYPE
6class YugabyteHandlerTest(unittest.TestCase):
7 @classmethod
8 def setUpClass(cls):
9 cls.kwargs = {
10 "connection_data": {
11 "host": "localhost",
12 "port": 5433,
13 "user": "admin",
14 "password": "",
15 "database": "yugabyte"
16 }
17 }
18 cls.handler = YugabyteHandler('test_yugabyte_handler', cls.kwargs)
20 def test_0_connect(self):
21 self.handler.connect()
23 def test_1_drop_table(self):
24 res = self.handler.query("DROP TABLE IF EXISTS PREM;")
25 assert res.type is not RESPONSE_TYPE.ERROR
27 def test_2_create_table(self):
28 res = self.handler.query("CREATE TABLE IF NOT EXISTS PREM (Premi varchar(50));")
29 assert res.type is not RESPONSE_TYPE.ERROR
31 def test_3_insert_table(self):
32 res = self.handler.query("INSERT INTO PREM VALUES('Radha <3 Krishna');")
33 assert res.type is not RESPONSE_TYPE.ERROR
35 def test_4_get_tables(self):
36 tables = self.handler.get_tables()
37 assert tables.type is not RESPONSE_TYPE.ERROR
39 def test_5_select_query(self):
40 query = "SELECT * FROM PREM;"
41 result = self.handler.native_query(query)
42 assert result.type is RESPONSE_TYPE.TABLE or RESPONSE_TYPE.OK
44 def test_6_check_connection(self):
45 self.handler.check_connection()
48if __name__ == '__main__':
49 unittest.main()