@@ -1262,6 +1262,110 @@ def test_create_transfer_status_transition_success(self, mock_post):
12621262
12631263 '''
12641264
1265+ PayPal Accounts
1266+
1267+ '''
1268+
1269+ def test_create_paypal_account_fail_need_user_token (self ):
1270+
1271+ with self .assertRaises (HyperwalletException ) as exc :
1272+ self .api .createPayPalAccount ()
1273+
1274+ self .assertEqual (exc .exception .message , 'userToken is required' )
1275+
1276+ def test_create_paypal_account_fail_need_data (self ):
1277+
1278+ with self .assertRaises (HyperwalletException ) as exc :
1279+ self .api .createPayPalAccount ('token' )
1280+
1281+ self .assertEqual (exc .exception .message , 'data is required' )
1282+
1283+ def test_create_paypal_account_fail_need_transfer_method_country (self ):
1284+
1285+ paypal_account_data = {
1286+ 'token' : 'test-token'
1287+ }
1288+ with self .assertRaises (HyperwalletException ) as exc :
1289+ self .api .createPayPalAccount ('token' , paypal_account_data )
1290+
1291+ self .assertEqual (exc .exception .message , 'transferMethodCountry is required' )
1292+
1293+ def test_create_paypal_account_fail_need_transfer_method_currency (self ):
1294+
1295+ paypal_account_data = {
1296+ 'transferMethodCountry' : 'test-transfer-method-country'
1297+ }
1298+ with self .assertRaises (HyperwalletException ) as exc :
1299+ self .api .createPayPalAccount ('token' , paypal_account_data )
1300+
1301+ self .assertEqual (exc .exception .message , 'transferMethodCurrency is required' )
1302+
1303+ def test_create_paypal_account_fail_need_email (self ):
1304+
1305+ paypal_account_data = {
1306+ 'transferMethodCountry' : 'test-transfer-method-country' ,
1307+ 'transferMethodCurrency' : 'test-transfer-method-currency'
1308+ }
1309+ with self .assertRaises (HyperwalletException ) as exc :
1310+ self .api .createPayPalAccount ('token' , paypal_account_data )
1311+
1312+ self .assertEqual (exc .exception .message , 'email is required' )
1313+
1314+ @mock .patch ('hyperwallet.utils.ApiClient._makeRequest' )
1315+ def test_create_paypal_account_success (self , mock_post ):
1316+
1317+ paypal_account_data = {
1318+ 'transferMethodCountry' : 'test-transfer-method-country' ,
1319+ 'transferMethodCurrency' : 'test-transfer-method-currency' ,
1320+ 'email' : 'test-email'
1321+ }
1322+ mock_post .return_value = paypal_account_data
1323+ response = self .api .createPayPalAccount ('token' , paypal_account_data )
1324+
1325+ self .assertTrue (response .email , paypal_account_data .get ('token' ))
1326+
1327+ def test_get_paypal_account_fail_need_user_token (self ):
1328+
1329+ with self .assertRaises (HyperwalletException ) as exc :
1330+ self .api .getPayPalAccount ()
1331+
1332+ self .assertEqual (exc .exception .message , 'userToken is required' )
1333+
1334+ def test_get_paypal_account_fail_need_paypal_account_token (self ):
1335+
1336+ with self .assertRaises (HyperwalletException ) as exc :
1337+ self .api .getPayPalAccount ('token' )
1338+
1339+ self .assertEqual (exc .exception .message , 'payPalAccountToken is required' )
1340+
1341+ @mock .patch ('hyperwallet.utils.ApiClient._makeRequest' )
1342+ def test_get_paypal_account_success (self , mock_get ):
1343+
1344+ paypal_account_data = {
1345+ 'email' : 'test-email'
1346+ }
1347+ mock_get .return_value = paypal_account_data
1348+ response = self .api .getPayPalAccount ('token' , 'token' )
1349+
1350+ self .assertTrue (response .email , paypal_account_data .get ('email' ))
1351+
1352+ def test_list_paypal_accounts_fail_need_user_token (self ):
1353+
1354+ with self .assertRaises (HyperwalletException ) as exc :
1355+ self .api .listPayPalAccounts ()
1356+
1357+ self .assertEqual (exc .exception .message , 'userToken is required' )
1358+
1359+ @mock .patch ('hyperwallet.utils.ApiClient._makeRequest' )
1360+ def test_list_paypal_accounts_success (self , mock_get ):
1361+
1362+ mock_get .return_value = {'data' : [self .data ]}
1363+ response = self .api .listPayPalAccounts ('token' )
1364+
1365+ self .assertTrue (response [0 ].token , self .data .get ('token' ))
1366+
1367+ '''
1368+
12651369 Payments
12661370
12671371 '''
0 commit comments