Coverage for mindsdb / integrations / handlers / google_books_handler / tests / test_google_books_handler.py: 0%

26 statements  

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

1import unittest 

2from mindsdb.integrations.handlers.google_books_handler.google_books_handler import GoogleBooksHandler 

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

4 

5 

6class GoogleBooksHandlerTest(unittest.TestCase): 

7 

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_books_handler\\credentials.json" 

14 } 

15 } 

16 cls.handler = GoogleBooksHandler('test_google_books_handler', **cls.kwargs) 

17 

18 def test_0_check_connection(self): 

19 assert self.handler.check_connection() 

20 

21 def test_1_get_tables(self): 

22 tables = self.handler.get_tables() 

23 assert tables.type is not RESPONSE_TYPE.ERROR 

24 

25 def test_2_select_volume_query(self): 

26 query = "SELECT summary FROM my_books.volumes WHERE q = 'Harry Potter'" 

27 result = self.handler.native_query(query) 

28 assert result.type is RESPONSE_TYPE.TABLE 

29 

30 def test_3_select_bookshelves_query(self): 

31 query = "SELECT title FROM my_books.bookshelves WHERE shelf > 1" 

32 result = self.handler.native_query(query) 

33 assert result.type is RESPONSE_TYPE.TABLE 

34 

35 def test_4_get_columns(self): 

36 columns = self.handler.get_columns('id') 

37 assert columns.type is not RESPONSE_TYPE.ERROR 

38 

39 

40if __name__ == '__main__': 

41 unittest.main()