Coverage for mindsdb / integrations / handlers / google_content_shopping_handler / tests / test_google_content_shopping_handler.py: 0%

43 statements  

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

1import unittest 

2from mindsdb.integrations.handlers.google_content_shopping_handler.google_content_shopping_handler import \ 

3 GoogleContentShoppingHandler 

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

5 

6 

7class GoogleSearchConsoleHandlerTest(unittest.TestCase): 

8 

9 @classmethod 

10 def setUpClass(cls): 

11 cls.kwargs = { 

12 "connection_data": { 

13 "merchant_id": "1234567890", 

14 "credentials": "/path/to/credentials.json" 

15 }, 

16 "file_storage": "/path/to/file_storage" 

17 } 

18 cls.handler = GoogleContentShoppingHandler('test_google_content_shopping_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_accounts_query(self): 

28 query = "SELECT * FROM accounts LIMIT 10" 

29 result = self.handler.native_query(query) 

30 assert result.type is RESPONSE_TYPE.TABLE 

31 

32 def test_3_select_orders_query(self): 

33 query = "SELECT kind FROM orders WHERE orderId > 100" 

34 result = self.handler.native_query(query) 

35 assert result.type is RESPONSE_TYPE.TABLE 

36 

37 def test_4_select_products_query(self): 

38 query = "SELECT price FROM products WHERE brand = 'Google' LIMIT 100" 

39 result = self.handler.native_query(query) 

40 assert result.type is RESPONSE_TYPE.TABLE 

41 

42 def test_5_delete_accounts_query(self): 

43 query = "DELETE FROM accounts WHERE accountId = '1234567890'" 

44 result = self.handler.native_query(query) 

45 assert result.type is RESPONSE_TYPE.TABLE 

46 

47 def test_6_delete_orders_query(self): 

48 query = "DELETE FROM orders WHERE orderId < '1234567890'" 

49 result = self.handler.native_query(query) 

50 assert result.type is RESPONSE_TYPE.TABLE 

51 

52 def test_7_delete_products_query(self): 

53 query = "DELETE FROM products WHERE brand = 'Google'" 

54 result = self.handler.native_query(query) 

55 assert result.type is RESPONSE_TYPE.TABLE 

56 

57 def test_8_update_products_query(self): 

58 query = "UPDATE products SET price = 100 WHERE productId > 120 AND updateMask = 'price'" 

59 result = self.handler.native_query(query) 

60 assert result.type is RESPONSE_TYPE.TABLE 

61 

62 

63if __name__ == '__main__': 

64 unittest.main()