forked from mindsdb/mindsdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_paypal_handler.py
More file actions
46 lines (36 loc) · 1.63 KB
/
test_paypal_handler.py
File metadata and controls
46 lines (36 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import os
import unittest
from mindsdb.integrations.handlers.paypal_handler.paypal_handler import PayPalHandler
from mindsdb.api.executor.data_types.response_type import RESPONSE_TYPE
class PayPalHandlerTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.kwargs = {
"connection_data": {
"mode": os.environ.get('MODE'),
"client_id": os.environ.get('CLIENT_ID'),
"client_secret": os.environ.get('CLIENT_SECRET'),
}
}
cls.handler = PayPalHandler('test_paypal_handler', **cls.kwargs)
def test_0_check_connection(self):
assert self.handler.check_connection()
def test_1_get_tables(self):
tables = self.handler.get_tables()
assert tables.type is not RESPONSE_TYPE.ERROR
def test_2_select_payments_query(self):
query = "SELECT * FROM test_paypal_handler.payments"
result = self.handler.native_query(query)
assert result.type is RESPONSE_TYPE.TABLE
def test_3_select_invoices_query(self):
query = "SELECT * FROM test_paypal_handler.invoices"
result = self.handler.native_query(query)
assert result.type is RESPONSE_TYPE.TABLE
def test_4_select_subscriptions_query(self):
query = "SELECT * FROM test_paypal_handler.subscriptions"
result = self.handler.native_query(query)
assert result.type is RESPONSE_TYPE.TABLE
def test_5_select_orders_query(self):
query = "SELECT * FROM test_paypal_handler.orders WHERE ids = ('')"
result = self.handler.native_query(query)
assert result.type is RESPONSE_TYPE.TABLE