Changeset 12278 for main/waeup.ikoba/branches
- Timestamp:
- 21 Dec 2014, 08:45:24 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/tests/test_payment.py
r12154 r12278 19 19 import re 20 20 import unittest 21 from zope.component import getUtilitiesFor, getSiteManager 22 from zope.interface import implements 21 23 from zope.interface.verify import verifyClass, verifyObject 22 24 from waeup.ikoba.payments.interfaces import ( 23 25 IPayment, STATE_UNPAID, STATE_PAID, STATE_FAILED, 26 IPaymentGatewayService, 24 27 ) 25 from waeup.ikoba.payments.payment import Payment 28 from waeup.ikoba.payments.payment import Payment, get_payment_providers 29 30 31 class HelperTests(unittest.TestCase): 32 33 def tearDown(self): 34 # unregister any IPaymentGatewayServices 35 sm = getSiteManager(None) 36 for name, util in getUtilitiesFor( 37 IPaymentGatewayService): 38 sm.unregisterUtility(util, name=name) 39 40 def test_get_payment_providers_no_providers(self): 41 # we can get a dict of all payment providers 42 result = get_payment_providers() 43 assert isinstance(result, dict) 44 assert result == {} 45 46 def test_get_payment_providers(self): 47 # we get any payment providers registered 48 sm = getSiteManager(None) 49 50 class FakeUtil(object): 51 implements(IPaymentGatewayService) 52 53 fake_util = FakeUtil() 54 sm.registerUtility(fake_util, name=u'some_name') 55 result = get_payment_providers() 56 assert isinstance(result, dict) 57 assert result.keys() == ['some_name', ] 58 assert result['some_name'] is fake_util 26 59 27 60
Note: See TracChangeset for help on using the changeset viewer.