本文整理汇总了Python中paypal.pro.helpers.PayPalWPP.createBillingAgreement方法的典型用法代码示例。如果您正苦于以下问题:Python PayPalWPP.createBillingAgreement方法的具体用法?Python PayPalWPP.createBillingAgreement怎么用?Python PayPalWPP.createBillingAgreement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paypal.pro.helpers.PayPalWPP
的用法示例。
在下文中一共展示了PayPalWPP.createBillingAgreement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_createBillingAgreement
# 需要导入模块: from paypal.pro.helpers import PayPalWPP [as 别名]
# 或者: from paypal.pro.helpers.PayPalWPP import createBillingAgreement [as 别名]
def test_createBillingAgreement(self, mock_request_object):
mock_request_object.return_value = 'ack=Success&billingagreementid=B-XXXXX&version=%s' % VERSION
wpp = PayPalWPP(REQUEST)
nvp = wpp.createBillingAgreement({'token': 'dummy token'})
call_args = mock_request_object.call_args
self.assertIn('VERSION=%s' % VERSION, call_args[0][1])
self.assertIn('METHOD=CreateBillingAgreement', call_args[0][1])
self.assertIn('TOKEN=dummy+token', call_args[0][1])
self.assertEquals(nvp.method, 'CreateBillingAgreement')
self.assertEquals(nvp.ack, 'Success')
mock_request_object.return_value = 'ack=Failure&l_errorcode=42&l_longmessage0=Broken'
with self.assertRaises(PayPalFailure):
nvp = wpp.createBillingAgreement({'token': 'dummy token'})