1 | ## $Id: test_student.py 8863 2012-07-01 12:31:04Z 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 | """Tests for students and related. |
---|
19 | """ |
---|
20 | from datetime import tzinfo |
---|
21 | from zope.component.interfaces import IFactory |
---|
22 | from zope.interface import verify |
---|
23 | from waeup.kofa.testing import FunctionalTestCase |
---|
24 | from kofacustom.nigeria.students.student import NigeriaStudent, NigeriaStudentFactory |
---|
25 | from kofacustom.nigeria.students.studycourse import ( |
---|
26 | NigeriaStudentStudyCourse, NigeriaStudentStudyCourseFactory) |
---|
27 | from kofacustom.nigeria.students.studylevel import ( |
---|
28 | NigeriaStudentStudyLevel, NigeriaCourseTicket, |
---|
29 | NigeriaStudentStudyLevelFactory, |
---|
30 | NigeriaCourseTicketFactory) |
---|
31 | from kofacustom.nigeria.students.interfaces import ( |
---|
32 | INigeriaStudent, INigeriaStudentStudyCourse, |
---|
33 | INigeriaStudentStudyLevel, INigeriaCourseTicket) |
---|
34 | from kofacustom.nigeria.testing import FunctionalLayer |
---|
35 | |
---|
36 | |
---|
37 | class NigeriaStudentFactoryTest(FunctionalTestCase): |
---|
38 | |
---|
39 | layer = FunctionalLayer |
---|
40 | |
---|
41 | def setUp(self): |
---|
42 | super(NigeriaStudentFactoryTest, self).setUp() |
---|
43 | self.factory = NigeriaStudentFactory() |
---|
44 | |
---|
45 | def tearDown(self): |
---|
46 | super(NigeriaStudentFactoryTest, self).tearDown() |
---|
47 | |
---|
48 | def test_interfaces(self): |
---|
49 | verify.verifyClass(IFactory, NigeriaStudentFactory) |
---|
50 | verify.verifyObject(IFactory, self.factory) |
---|
51 | |
---|
52 | def test_factory(self): |
---|
53 | obj = self.factory() |
---|
54 | assert isinstance(obj, NigeriaStudent) |
---|
55 | |
---|
56 | def test_getInterfaces(self): |
---|
57 | implemented_by = self.factory.getInterfaces() |
---|
58 | assert implemented_by.isOrExtends(INigeriaStudent) |
---|
59 | |
---|
60 | class NigeriaStudentStudyCourseFactoryTest(FunctionalTestCase): |
---|
61 | |
---|
62 | layer = FunctionalLayer |
---|
63 | |
---|
64 | def setUp(self): |
---|
65 | super(NigeriaStudentStudyCourseFactoryTest, self).setUp() |
---|
66 | self.factory = NigeriaStudentStudyCourseFactory() |
---|
67 | |
---|
68 | def tearDown(self): |
---|
69 | super(NigeriaStudentStudyCourseFactoryTest, self).tearDown() |
---|
70 | |
---|
71 | def test_interfaces(self): |
---|
72 | verify.verifyClass(IFactory, NigeriaStudentStudyCourseFactory) |
---|
73 | verify.verifyObject(IFactory, self.factory) |
---|
74 | |
---|
75 | def test_factory(self): |
---|
76 | obj = self.factory() |
---|
77 | assert isinstance(obj, NigeriaStudentStudyCourse) |
---|
78 | |
---|
79 | def test_getInterfaces(self): |
---|
80 | implemented_by = self.factory.getInterfaces() |
---|
81 | assert implemented_by.isOrExtends(INigeriaStudentStudyCourse) |
---|
82 | |
---|
83 | class NigeriaStudentStudyLevelFactoryTest(FunctionalTestCase): |
---|
84 | |
---|
85 | layer = FunctionalLayer |
---|
86 | |
---|
87 | def setUp(self): |
---|
88 | super(NigeriaStudentStudyLevelFactoryTest, self).setUp() |
---|
89 | self.factory = NigeriaStudentStudyLevelFactory() |
---|
90 | |
---|
91 | def tearDown(self): |
---|
92 | super(NigeriaStudentStudyLevelFactoryTest, self).tearDown() |
---|
93 | |
---|
94 | def test_interfaces(self): |
---|
95 | verify.verifyClass(IFactory, NigeriaStudentStudyLevelFactory) |
---|
96 | verify.verifyObject(IFactory, self.factory) |
---|
97 | |
---|
98 | def test_factory(self): |
---|
99 | obj = self.factory() |
---|
100 | assert isinstance(obj, NigeriaStudentStudyLevel) |
---|
101 | |
---|
102 | def test_getInterfaces(self): |
---|
103 | implemented_by = self.factory.getInterfaces() |
---|
104 | assert implemented_by.isOrExtends(INigeriaStudentStudyLevel) |
---|
105 | |
---|
106 | class NigeriaCourseTicketFactoryTest(FunctionalTestCase): |
---|
107 | |
---|
108 | layer = FunctionalLayer |
---|
109 | |
---|
110 | def setUp(self): |
---|
111 | super(NigeriaCourseTicketFactoryTest, self).setUp() |
---|
112 | self.factory = NigeriaCourseTicketFactory() |
---|
113 | |
---|
114 | def tearDown(self): |
---|
115 | super(NigeriaCourseTicketFactoryTest, self).tearDown() |
---|
116 | |
---|
117 | def test_interfaces(self): |
---|
118 | verify.verifyClass(IFactory, NigeriaCourseTicketFactory) |
---|
119 | verify.verifyObject(IFactory, self.factory) |
---|
120 | |
---|
121 | def test_factory(self): |
---|
122 | obj = self.factory() |
---|
123 | assert isinstance(obj, NigeriaCourseTicket) |
---|
124 | |
---|
125 | def test_getInterfaces(self): |
---|
126 | implemented_by = self.factory.getInterfaces() |
---|
127 | assert implemented_by.isOrExtends(INigeriaCourseTicket) |
---|