1 | ## $Id: test_student.py 10765 2013-11-19 12:57:15Z 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.ecns.students.student import CustomStudent, CustomStudentFactory |
---|
25 | from kofacustom.ecns.students.studycourse import ( |
---|
26 | CustomStudentStudyCourse, CustomStudentStudyCourseFactory) |
---|
27 | from kofacustom.ecns.students.studylevel import ( |
---|
28 | CustomStudentStudyLevel, CustomCourseTicket, |
---|
29 | CustomStudentStudyLevelFactory, |
---|
30 | CustomCourseTicketFactory) |
---|
31 | from kofacustom.ecns.students.interfaces import ( |
---|
32 | ICustomStudent, ICustomStudentStudyCourse, |
---|
33 | ICustomStudentStudyLevel, ICustomCourseTicket) |
---|
34 | from kofacustom.ecns.testing import FunctionalLayer |
---|
35 | |
---|
36 | |
---|
37 | class CustomStudentFactoryTest(FunctionalTestCase): |
---|
38 | |
---|
39 | layer = FunctionalLayer |
---|
40 | |
---|
41 | def setUp(self): |
---|
42 | super(CustomStudentFactoryTest, self).setUp() |
---|
43 | self.factory = CustomStudentFactory() |
---|
44 | |
---|
45 | def tearDown(self): |
---|
46 | super(CustomStudentFactoryTest, self).tearDown() |
---|
47 | |
---|
48 | def test_interfaces(self): |
---|
49 | verify.verifyClass(IFactory, CustomStudentFactory) |
---|
50 | verify.verifyObject(IFactory, self.factory) |
---|
51 | |
---|
52 | def test_factory(self): |
---|
53 | obj = self.factory() |
---|
54 | assert isinstance(obj, CustomStudent) |
---|
55 | |
---|
56 | def test_getInterfaces(self): |
---|
57 | implemented_by = self.factory.getInterfaces() |
---|
58 | assert implemented_by.isOrExtends(ICustomStudent) |
---|
59 | |
---|
60 | class CustomStudentStudyCourseFactoryTest(FunctionalTestCase): |
---|
61 | |
---|
62 | layer = FunctionalLayer |
---|
63 | |
---|
64 | def setUp(self): |
---|
65 | super(CustomStudentStudyCourseFactoryTest, self).setUp() |
---|
66 | self.factory = CustomStudentStudyCourseFactory() |
---|
67 | |
---|
68 | def tearDown(self): |
---|
69 | super(CustomStudentStudyCourseFactoryTest, self).tearDown() |
---|
70 | |
---|
71 | def test_interfaces(self): |
---|
72 | verify.verifyClass(IFactory, CustomStudentStudyCourseFactory) |
---|
73 | verify.verifyObject(IFactory, self.factory) |
---|
74 | |
---|
75 | def test_factory(self): |
---|
76 | obj = self.factory() |
---|
77 | assert isinstance(obj, CustomStudentStudyCourse) |
---|
78 | |
---|
79 | def test_getInterfaces(self): |
---|
80 | implemented_by = self.factory.getInterfaces() |
---|
81 | assert implemented_by.isOrExtends(ICustomStudentStudyCourse) |
---|
82 | |
---|
83 | class CustomStudentStudyLevelFactoryTest(FunctionalTestCase): |
---|
84 | |
---|
85 | layer = FunctionalLayer |
---|
86 | |
---|
87 | def setUp(self): |
---|
88 | super(CustomStudentStudyLevelFactoryTest, self).setUp() |
---|
89 | self.factory = CustomStudentStudyLevelFactory() |
---|
90 | |
---|
91 | def tearDown(self): |
---|
92 | super(CustomStudentStudyLevelFactoryTest, self).tearDown() |
---|
93 | |
---|
94 | def test_interfaces(self): |
---|
95 | verify.verifyClass(IFactory, CustomStudentStudyLevelFactory) |
---|
96 | verify.verifyObject(IFactory, self.factory) |
---|
97 | |
---|
98 | def test_factory(self): |
---|
99 | obj = self.factory() |
---|
100 | assert isinstance(obj, CustomStudentStudyLevel) |
---|
101 | |
---|
102 | def test_getInterfaces(self): |
---|
103 | implemented_by = self.factory.getInterfaces() |
---|
104 | assert implemented_by.isOrExtends(ICustomStudentStudyLevel) |
---|
105 | |
---|
106 | class CustomCourseTicketFactoryTest(FunctionalTestCase): |
---|
107 | |
---|
108 | layer = FunctionalLayer |
---|
109 | |
---|
110 | def setUp(self): |
---|
111 | super(CustomCourseTicketFactoryTest, self).setUp() |
---|
112 | self.factory = CustomCourseTicketFactory() |
---|
113 | |
---|
114 | def tearDown(self): |
---|
115 | super(CustomCourseTicketFactoryTest, self).tearDown() |
---|
116 | |
---|
117 | def test_interfaces(self): |
---|
118 | verify.verifyClass(IFactory, CustomCourseTicketFactory) |
---|
119 | verify.verifyObject(IFactory, self.factory) |
---|
120 | |
---|
121 | def test_factory(self): |
---|
122 | obj = self.factory() |
---|
123 | assert isinstance(obj, CustomCourseTicket) |
---|
124 | |
---|
125 | def test_getInterfaces(self): |
---|
126 | implemented_by = self.factory.getInterfaces() |
---|
127 | assert implemented_by.isOrExtends(ICustomCourseTicket) |
---|