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 hostels. |
---|
18 | """ |
---|
19 | from zope.interface.verify import verifyClass, verifyObject |
---|
20 | from waeup.sirp.hostels.interfaces import ( |
---|
21 | IHostelsContainer, IHostel) |
---|
22 | from waeup.sirp.hostels.container import HostelsContainer |
---|
23 | from waeup.sirp.hostels.hostel import Hostel |
---|
24 | from waeup.sirp.testing import (FunctionalLayer, FunctionalTestCase) |
---|
25 | |
---|
26 | class HostelsContainerTestCase(FunctionalTestCase): |
---|
27 | |
---|
28 | layer = FunctionalLayer |
---|
29 | |
---|
30 | def test_interfaces(self): |
---|
31 | # Make sure the correct interfaces are implemented. |
---|
32 | self.assertTrue( |
---|
33 | verifyClass( |
---|
34 | IHostelsContainer, HostelsContainer) |
---|
35 | ) |
---|
36 | self.assertTrue( |
---|
37 | verifyObject( |
---|
38 | IHostelsContainer, HostelsContainer()) |
---|
39 | ) |
---|
40 | self.assertTrue( |
---|
41 | verifyClass( |
---|
42 | IHostel, Hostel) |
---|
43 | ) |
---|
44 | self.assertTrue( |
---|
45 | verifyObject( |
---|
46 | IHostel, Hostel()) |
---|
47 | ) |
---|
48 | return |
---|
49 | |
---|
50 | def test_base(self): |
---|
51 | # We cannot call the fundamental methods of a base in that case |
---|
52 | container = HostelsContainer() |
---|
53 | self.assertRaises( |
---|
54 | NotImplementedError, container.archive) |
---|
55 | self.assertRaises( |
---|
56 | NotImplementedError, container.clear) |
---|