Changeset 6875 for main/waeup.sirp/trunk/src/waeup/sirp/payments
- Timestamp:
- 12 Oct 2011, 19:28:49 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/payments
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/payments/payment.py
r6869 r6875 20 20 from datetime import datetime 21 21 from grok import index 22 from zope.component.interfaces import IFactory23 from zope.interface import implementedBy24 22 from waeup.sirp.payments.interfaces import ( 25 23 IPayment, ISCPayment, IOnlinePayment) … … 73 71 74 72 OnlinePayment = attrs_to_fields(OnlinePayment) 75 76 # Online payments must be importable. So we might need a factory.77 class OnlinePaymentFactory(grok.GlobalUtility):78 """A factory for online payments.79 """80 grok.implements(IFactory)81 grok.name(u'waeup.OnlinePayment')82 title = u"Create a new online payment.",83 description = u"This factory instantiates new online payment instances."84 85 def __call__(self, *args, **kw):86 return OnlinePayment()87 88 def getInterfaces(self):89 return implementedBy(OnlinePayment) -
main/waeup.sirp/trunk/src/waeup/sirp/payments/tests.py
r6866 r6875 22 22 from waeup.sirp.payments.container import PaymentsContainer 23 23 from waeup.sirp.payments.payment import ( 24 SCPayment, OnlinePayment , OnlinePaymentFactory)24 SCPayment, OnlinePayment) 25 25 from waeup.sirp.testing import (FunctionalLayer, FunctionalTestCase) 26 26 … … 64 64 self.assertRaises( 65 65 NotImplementedError, container.clear) 66 67 class OnlinePaymentFactoryTest(FunctionalTestCase):68 69 layer = FunctionalLayer70 71 def setUp(self):72 super(OnlinePaymentFactoryTest, self).setUp()73 self.factory = OnlinePaymentFactory()74 return75 76 def tearDown(self):77 super(OnlinePaymentFactoryTest, self).tearDown()78 return79 80 def test_factory(self):81 obj = self.factory()82 assert isinstance(obj, OnlinePayment)83 84 def test_getInterfaces(self):85 implemented_by = self.factory.getInterfaces()86 assert implemented_by.isOrExtends(IOnlinePayment)
Note: See TracChangeset for help on using the changeset viewer.