Changeset 12734 for main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/tests/test_demo_provider.py
- Timestamp:
- 11 Mar 2015, 17:08:34 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/tests/test_demo_provider.py
r12712 r12734 1 import decimal2 1 from zope.component import queryUtility 3 2 from zope.component.hooks import setSite … … 10 9 ) 11 10 from waeup.ikoba.app import Company 12 from waeup.ikoba.payments.payment import Payer, Pay mentItem, Payee, Payment11 from waeup.ikoba.payments.payment import Payer, Payee, Payment 13 12 from waeup.ikoba.payments.demo_provider import ( 14 13 DemoCreditcardPaymentService, 15 14 ) 15 from waeup.ikoba.payments.tests.test_payment import FakePayer, FakePayable 16 16 17 17 … … 35 35 # we can get payments from payment gateways 36 36 service = DemoCreditcardPaymentService() 37 payer, pay ment_item, payee = Payer(), PaymentItem(), Payee()37 payer, payable, payee = Payer(), FakePayable(), Payee() 38 38 payer.payer_id = u'SOME_PAYER_ID' 39 result = service.create_payment(payer, [], payee)39 result = service.create_payment(payer, payable, payee) 40 40 assert IPayment.providedBy(result) 41 41 assert result.gateway_service == u'demo_creditcard' 42 42 assert result.state == STATE_UNPAID 43 assert len(result) == 0 # no items stored44 45 def test_create_payment_honors_payment_item(self):46 # we inspect payment items and take their values47 service = DemoCreditcardPaymentService()48 payer, payment_item, payee = Payer(), PaymentItem(), Payee()49 payment_item.item_id = u'SOME_ITEM_ID'50 payer.payer_id = u'SOME_PAYER_ID'51 payment_item.amount = decimal.Decimal("300.99")52 result = service.create_payment(payer, [payment_item], payee)53 self.assertEqual(result.amount, payment_item.amount)54 assert len(result) == 155 43 56 44 def test_create_payment_honors_payer(self): 57 45 # we inspect payers when creating their payments 58 46 service = DemoCreditcardPaymentService() 59 payer, payment_item, payee = Payer(), PaymentItem(), Payee() 60 payment_item.item_id = u'SOME_ITEM_ID' 47 payer, payable, payee = Payer(), FakePayable(), Payee() 61 48 payer.payer_id = u'SOME_PAYER_ID' 62 result = service.create_payment(payer, [payment_item], payee)49 result = service.create_payment(payer, payable, payee) 63 50 assert result.payer_id == payer.payer_id 64 51 … … 78 65 # we are redirected to 'index' in the beginning 79 66 service = DemoCreditcardPaymentService() 80 p1 = Payment( )67 p1 = Payment(FakePayer(), FakePayable()) 81 68 self.app['payments']['1'] = p1 82 69 p_id = p1.payment_id
Note: See TracChangeset for help on using the changeset viewer.