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