def capture_fixture(): capture = litleXmlFields.capture() capture.litleTxnId = 123456000 capture.amount = 110 capture.payPalNotes = "Notes" return capture
def testAddCapture(self): batchRequest = self.litleBatchFileRequest.createBatch() capture = litleXmlFields.capture() capture.amount = 25 self.litleBatchFileRequest.tnxToXml = MagicMock(return_value='') batchRequest.addTransaction(capture) assert(batchRequest._batchRequest.captureAmount == 25) assert(batchRequest._batchRequest.numCaptures == 1) assert(batchRequest.numOfTxn == 1)
def testCapture(self): capture = litleXmlFields.capture() capture.litleTxnId = 123456000 capture.amount = 106 capture.payPalNotes = "Notes" comm = Communications(config) comm.http_post = MagicMock() litle = litleOnlineRequest(config) litle.setCommunications(comm) litle._processResponse = MagicMock(return_value=None) litle.sendRequest(capture) match_re = RegexMatcher(".*?<litleOnlineRequest.*?<capture.*?<litleTxnId>123456000</litleTxnId>.*?</capture>.*?") comm.http_post.assert_called_with(match_re, url=ANY, proxy=ANY, timeout=ANY)
def testCapture(self): capture = litleXmlFields.capture() capture.litleTxnId = 123456000 capture.amount = 106 capture.payPalNotes = "Notes" capture.id="id" comm = Communications(config) comm.http_post = MagicMock() litle = litleOnlineRequest(config) litle.setCommunications(comm) litle._processResponse = MagicMock(return_value=None) litle.sendRequest(capture) comm.http_post.assert_called_once() match_re = RegexMatcher(".*?<litleOnlineRequest.*?<capture.*?<litleTxnId>123456000</litleTxnId>.*?</capture>.*?") comm.http_post.assert_called_with(match_re, url=ANY, proxy=ANY, timeout=ANY)
def testCaptureWithoutCustomBilling(self): capture = litleXmlFields.capture() capture.litleTxnId = 123456000 capture.amount = 106 capture.payPalNotes = "Notes" customBilling=litleXmlFields.customBilling() customBilling.phone='6174445555' customBilling.descriptor='description' capture.customBilling=customBilling comm = Communications(config) comm.http_post = MagicMock() litle = litleOnlineRequest(config) litle.setCommunications(comm) litle._processResponse = MagicMock(return_value=None) with self.assertRaises(Exception): litle.sendRequest(authorization)
def testCaptureWithoutCustomBilling(self): capture = litleXmlFields.capture() capture.litleTxnId = 123456000 capture.amount = 106 capture.payPalNotes = "Notes" customBilling = litleXmlFields.customBilling() customBilling.phone = '6174445555' customBilling.descriptor = 'description' capture.customBilling = customBilling comm = Communications(config) comm.http_post = MagicMock() litle = litleOnlineRequest(config) litle.setCommunications(comm) litle._processResponse = MagicMock(return_value=None) with self.assertRaises(Exception): litle.sendRequest(authorization)