Coverage for mindsdb / integrations / handlers / edgelessdb_handler / tests / test_edgelessdb_handler.py: 0%
34 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.edgelessdb_handler.edgelessdb_handler import EdgelessDBHandler
3from mindsdb.api.executor.data_types.response_type import RESPONSE_TYPE
6class EdgelessDBHandlerTest(unittest.TestCase):
7 @classmethod
8 def setUpClass(cls):
9 cls.kwargs = {
10 "connection_data": {
11 "host": "localhost",
12 "port": 8080,
13 "user": "root",
14 "password": "password",
15 "database": "test",
16 }
17 }
18 cls.handler = EdgelessDBHandler('test_edgelessdb_handler', **cls.kwargs)
20 def test_0_connect(self):
21 assert self.handler.connect()
23 def test_1_drop_table(self):
24 res = self.handler.query("DROP TABLE IF EXISTS TEST_TABLE")
25 assert res.type is RESPONSE_TYPE.OK
27 def test_2_create_table(self):
28 res = self.handler.query(
29 '''CREATE TABLE TEST_TABLE (
30 ID INT PRIMARY KEY,
31 NAME VARCHAR(14)
32 )'''
33 )
34 assert res.type is RESPONSE_TYPE.OK
36 def test_3_insert(self):
37 res = self.handler.query(
38 """INSERT INTO TEST_TABLE
39 VALUES
40 (100,'ONE HUNDRED'),
41 (200,'TWO HUNDRED'),
42 (300,'THREE HUNDRED')"""
43 )
44 assert res.type is RESPONSE_TYPE.OK
46 def test_4_select(self):
47 res = self.handler.query('SELECT * FROM TEST_TABLE')
48 assert res.type is RESPONSE_TYPE.TABLE
50 def test_5_check_connection(self):
51 assert self.handler.check_connection()
53 def test_6_get_tables(self):
54 res = self.handler.get_tables()
55 assert res.type is RESPONSE_TYPE.TABLE
57 def test_7_get_columns(self):
58 res = self.handler.get_columns("TEST_TABLE")
59 assert res.type is RESPONSE_TYPE.TABLE
61 def test_8_disconnect(self):
62 assert self.handler.disconnect()
65if __name__ == '__main__':
66 unittest.main()