## $Id: test_student.py 16983 2022-07-05 07:50:56Z 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.lpng.students.student import CustomStudent, CustomStudentFactory from kofacustom.lpng.students.studycourse import ( CustomStudentStudyCourse, CustomStudentStudyCourseFactory) from kofacustom.lpng.students.studylevel import ( CustomStudentStudyLevel, CustomCourseTicket, CustomStudentStudyLevelFactory, CustomCourseTicketFactory) from kofacustom.lpng.students.interfaces import ( ICustomStudent, ICustomStudentStudyCourse, ICustomStudentStudyLevel, ICustomCourseTicket) from kofacustom.lpng.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)