- Timestamp:
- 9 Mar 2015, 05:07:04 (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
r12671 r12701 1 1 import decimal 2 from zope.component import queryUtility 3 from zope.component.hooks import setSite 2 4 from zope.interface.verify import verifyClass, verifyObject 3 5 from waeup.ikoba.testing import ( … … 7 9 IPaymentGatewayService, IPayment, STATE_UNPAID, 8 10 ) 9 from waeup.ikoba.payments.payment import Payer, PaymentItem, Payee 11 from waeup.ikoba.app import Company 12 from waeup.ikoba.payments.payment import Payer, PaymentItem, Payee, Payment 10 13 from waeup.ikoba.payments.demo_provider import ( 11 14 DemoCreditcardPaymentService, … … 16 19 17 20 layer = FunctionalLayer 21 22 def setUp(self): 23 super(DemoCreditcarPaymentServiceTests, self).setUp() 24 self.app = Company() 25 self.getRootFolder()['app'] = self.app 26 setSite(self.app) 18 27 19 28 def test_iface(self): … … 56 65 def test_get_service_by_utility_name(self): 57 66 # we can get the demo credit card service by its utility name 58 from zope.component import queryUtility59 67 service = queryUtility( 60 68 IPaymentGatewayService, name="demo_creditcard") 61 69 assert service is not None 70 71 def test_next_step_invalid_id(self): 72 # we cannot go to non-existent payments 73 service = DemoCreditcardPaymentService() 74 result = service.next_step('not-existent-payment-id') 75 assert result == (None, None) 76 77 def test_next_step(self): 78 # we are redirected to 'index' in the beginning 79 service = DemoCreditcardPaymentService() 80 p1 = Payment() 81 self.app['payments']['1'] = p1 82 p_id = p1.payment_id 83 result = service.next_step(p_id) 84 assert result == (p1, 'index')
Note: See TracChangeset for help on using the changeset viewer.