Coverage for mindsdb / integrations / handlers / google_calendar_handler / tests / test_google_calendar_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.google_calendar_handler.google_calendar_handler import GoogleCalendarHandler
3from mindsdb.api.executor.data_types.response_type import RESPONSE_TYPE
6class GoogleCalendarHandlerTest(unittest.TestCase):
8 @classmethod
9 def setUpClass(cls):
10 cls.kwargs = {
11 "connection_data": {
12 "credentials": "C:\\Users\\panagiotis\\Desktop\\GitHub\\mindsdb\\mindsdb\\integrations\\handlers"
13 "\\google_calendar_handler\\credentials.json",
14 }
15 }
16 cls.handler = GoogleCalendarHandler('test_google_calendar_handler', **cls.kwargs)
18 def test_0_check_connection(self):
19 assert self.handler.check_connection()
21 def test_1_get_tables(self):
22 tables = self.handler.get_tables()
23 assert tables.type is not RESPONSE_TYPE.ERROR
25 def test_2_select_query(self):
26 query = "SELECT summary FROM calendar.events WHERE id = 1"
27 result = self.handler.native_query(query)
28 assert result.type is RESPONSE_TYPE.TABLE
30 def test_3_get_columns(self):
31 columns = self.handler.get_columns('id')
32 assert columns.type is not RESPONSE_TYPE.ERROR
34 def test_4_insert(self):
35 res = self.handler.native_query(
36 "INSERT INTO calendar.events VALUES (100, '2023-04-21 00:00:00', '2023-05-01 00:00:00',"
37 "'summary', 'description','location', 'status', 'html_link', "
38 "'creator', 'organizer', 'reminders', "
39 "'timeZone', 'calendar_id', 'attendees'")
40 assert res.type is not RESPONSE_TYPE.ERROR
42 def test_5_update(self):
43 res = self.handler.native_query("UPDATE calendar.events SET summary = 'ONE HUNDRED' WHERE id = 100")
44 assert res.type is not RESPONSE_TYPE.ERROR
46 def test_6_delete(self):
47 res = self.handler.native_query("DELETE FROM calendar.events WHERE id = 100")
48 assert res.type is not RESPONSE_TYPE.ERROR
50 def test_7_delete_multiple(self):
51 res = self.handler.native_query("DELETE FROM calendar.events WHERE id > 1 AND id < 20")
52 assert res.type is not RESPONSE_TYPE.ERROR
55if __name__ == '__main__':
56 unittest.main()