[6864] | 1 | ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann |
---|
| 2 | ## This program is free software; you can redistribute it and/or modify |
---|
| 3 | ## it under the terms of the GNU General Public License as published by |
---|
| 4 | ## the Free Software Foundation; either version 2 of the License, or |
---|
| 5 | ## (at your option) any later version. |
---|
| 6 | ## |
---|
| 7 | ## This program is distributed in the hope that it will be useful, |
---|
| 8 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 9 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 10 | ## GNU General Public License for more details. |
---|
| 11 | ## |
---|
| 12 | ## You should have received a copy of the GNU General Public License |
---|
| 13 | ## along with this program; if not, write to the Free Software |
---|
| 14 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 15 | ## |
---|
| 16 | """ |
---|
| 17 | Tests for payments. |
---|
| 18 | """ |
---|
| 19 | from zope.interface.verify import verifyClass, verifyObject |
---|
| 20 | from waeup.sirp.payments.interfaces import ( |
---|
| 21 | IPaymentsContainer, ISCPayment, IOnlinePayment) |
---|
| 22 | from waeup.sirp.payments.container import PaymentsContainer |
---|
| 23 | from waeup.sirp.payments.payment import ( |
---|
[6875] | 24 | SCPayment, OnlinePayment) |
---|
[6864] | 25 | from waeup.sirp.testing import (FunctionalLayer, FunctionalTestCase) |
---|
| 26 | |
---|
| 27 | class PaymentsContainerTestCase(FunctionalTestCase): |
---|
| 28 | |
---|
| 29 | layer = FunctionalLayer |
---|
| 30 | |
---|
| 31 | def test_interfaces(self): |
---|
| 32 | # Make sure the correct interfaces are implemented. |
---|
| 33 | self.assertTrue( |
---|
| 34 | verifyClass( |
---|
| 35 | IPaymentsContainer, PaymentsContainer) |
---|
| 36 | ) |
---|
| 37 | self.assertTrue( |
---|
| 38 | verifyObject( |
---|
| 39 | IPaymentsContainer, PaymentsContainer()) |
---|
| 40 | ) |
---|
| 41 | self.assertTrue( |
---|
| 42 | verifyClass( |
---|
| 43 | ISCPayment, SCPayment) |
---|
| 44 | ) |
---|
| 45 | self.assertTrue( |
---|
| 46 | verifyClass( |
---|
| 47 | IOnlinePayment, OnlinePayment) |
---|
| 48 | ) |
---|
| 49 | self.assertTrue( |
---|
| 50 | verifyObject( |
---|
| 51 | ISCPayment, SCPayment()) |
---|
| 52 | ) |
---|
| 53 | self.assertTrue( |
---|
| 54 | verifyObject( |
---|
| 55 | IOnlinePayment, OnlinePayment()) |
---|
| 56 | ) |
---|
| 57 | return |
---|
| 58 | |
---|
| 59 | def test_base(self): |
---|
| 60 | # We cannot call the fundamental methods of a base in that case |
---|
| 61 | container = PaymentsContainer() |
---|
| 62 | self.assertRaises( |
---|
| 63 | NotImplementedError, container.archive) |
---|
| 64 | self.assertRaises( |
---|
| 65 | NotImplementedError, container.clear) |
---|