## $Id: test_student.py 14035 2016-07-20 11:38:34Z henrik $ ## ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## """Tests for students and related. """ from datetime import tzinfo from zope.component.interfaces import IFactory from zope.interface import verify from waeup.kofa.testing import FunctionalTestCase from kofacustom.coewarri.students.student import CustomStudent, CustomStudentFactory from kofacustom.coewarri.students.studycourse import ( CustomStudentStudyCourse, CustomStudentStudyCourseFactory) from kofacustom.coewarri.students.studylevel import ( CustomStudentStudyLevel, CustomCourseTicket, CustomStudentStudyLevelFactory, CustomCourseTicketFactory) from kofacustom.coewarri.students.interfaces import ( ICustomStudent, ICustomStudentStudyCourse, ICustomStudentStudyLevel, ICustomCourseTicket) from kofacustom.coewarri.testing import FunctionalLayer class CustomStudentFactoryTest(FunctionalTestCase): layer = FunctionalLayer def setUp(self): super(CustomStudentFactoryTest, self).setUp() self.factory = CustomStudentFactory() def tearDown(self): super(CustomStudentFactoryTest, self).tearDown() def test_interfaces(self): verify.verifyClass(IFactory, CustomStudentFactory) verify.verifyObject(IFactory, self.factory) def test_factory(self): obj = self.factory() assert isinstance(obj, CustomStudent) def test_getInterfaces(self): implemented_by = self.factory.getInterfaces() assert implemented_by.isOrExtends(ICustomStudent) class CustomStudentStudyCourseFactoryTest(FunctionalTestCase): layer = FunctionalLayer def setUp(self): super(CustomStudentStudyCourseFactoryTest, self).setUp() self.factory = CustomStudentStudyCourseFactory() def tearDown(self): super(CustomStudentStudyCourseFactoryTest, self).tearDown() def test_interfaces(self): verify.verifyClass(IFactory, CustomStudentStudyCourseFactory) verify.verifyObject(IFactory, self.factory) def test_factory(self): obj = self.factory() assert isinstance(obj, CustomStudentStudyCourse) def test_getInterfaces(self): implemented_by = self.factory.getInterfaces() assert implemented_by.isOrExtends(ICustomStudentStudyCourse) class CustomStudentStudyLevelFactoryTest(FunctionalTestCase): layer = FunctionalLayer def setUp(self): super(CustomStudentStudyLevelFactoryTest, self).setUp() self.factory = CustomStudentStudyLevelFactory() def tearDown(self): super(CustomStudentStudyLevelFactoryTest, self).tearDown() def test_interfaces(self): verify.verifyClass(IFactory, CustomStudentStudyLevelFactory) verify.verifyObject(IFactory, self.factory) def test_factory(self): obj = self.factory() assert isinstance(obj, CustomStudentStudyLevel) def test_getInterfaces(self): implemented_by = self.factory.getInterfaces() assert implemented_by.isOrExtends(ICustomStudentStudyLevel) class CustomCourseTicketFactoryTest(FunctionalTestCase): layer = FunctionalLayer def setUp(self): super(CustomCourseTicketFactoryTest, self).setUp() self.factory = CustomCourseTicketFactory() def tearDown(self): super(CustomCourseTicketFactoryTest, self).tearDown() def test_interfaces(self): verify.verifyClass(IFactory, CustomCourseTicketFactory) verify.verifyObject(IFactory, self.factory) def test_factory(self): obj = self.factory() assert isinstance(obj, CustomCourseTicket) def test_getInterfaces(self): implemented_by = self.factory.getInterfaces() assert implemented_by.isOrExtends(ICustomCourseTicket)