Coverage for mindsdb / integrations / handlers / sharepoint_handler / tests / test_sharepoint_handler.py: 0%

35 statements  

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

1import os 

2import unittest 

3from mindsdb.integrations.handlers.sharepoint_handler import Handler as SharepointHandler 

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

5 

6 

7class SharepointHandlerTest(unittest.TestCase): 

8 

9 @classmethod 

10 def setUpClass(cls): 

11 cls.kwargs = { 

12 "connection_data": { 

13 "clientId": os.environ.get('CLIENT_ID'), 

14 "clientSecret": os.environ.get('CLIENT_SECRET'), 

15 "tenantId": os.environ.get('TENANT_ID'), 

16 } 

17 } 

18 cls.handler = SharepointHandler('test_sharepoint_handler', **cls.kwargs) 

19 

20 def test_0_check_connection(self): 

21 assert self.handler.check_connection() 

22 

23 def test_1_get_tables(self): 

24 tables = self.handler.get_tables() 

25 assert tables.type is not RESPONSE_TYPE.ERROR 

26 

27 def test_2_select_sites_query(self): 

28 query = "SELECT * FROM test_sharepoint_handler.sites" 

29 result = self.handler.native_query(query) 

30 assert result.type is RESPONSE_TYPE.TABLE 

31 

32 def test_3_select_lists_query(self): 

33 query = "SELECT * FROM test_sharepoint_handler.lists" 

34 result = self.handler.native_query(query) 

35 assert result.type is RESPONSE_TYPE.TABLE 

36 

37 def test_4_select_siteColumns_query(self): 

38 query = "SELECT * FROM test_sharepoint_handler.siteColumns" 

39 result = self.handler.native_query(query) 

40 assert result.type is RESPONSE_TYPE.TABLE 

41 

42 def test_5_select_listItems_query(self): 

43 query = "SELECT * FROM test_sharepoint_handler.listItems" 

44 result = self.handler.native_query(query) 

45 assert result.type is RESPONSE_TYPE.TABLE 

46 

47 def test_6_get_columns(self): 

48 columns = self.handler.get_columns('test_sharepoint_handler.siteColumns') 

49 assert columns.type is not RESPONSE_TYPE.ERROR 

50 

51 

52if __name__ == '__main__': 

53 unittest.main()