source: main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_student.py @ 7026

Last change on this file since 7026 was 6989, checked in by Henrik Bettermann, 13 years ago

Initialze bed ticket system.

  • Property svn:keywords set to Id
File size: 3.4 KB
Line 
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"""Tests for students and related.
17"""
18from zope.component.interfaces import IFactory
19from zope.interface import verify
20from waeup.sirp.students.student import Student, StudentFactory
21from waeup.sirp.students.studycourse import StudentStudyCourse
22from waeup.sirp.students.studylevel import StudentStudyLevel, CourseTicket
23from waeup.sirp.students.payments import StudentPaymentsContainer
24from waeup.sirp.students.accommodation import StudentAccommodation, BedTicket
25from waeup.sirp.students.interfaces import (
26    IStudent, IStudentStudyCourse, IStudentPaymentsContainer, IStudentAccommodation,
27    IStudentStudyLevel, ICourseTicket, IBedTicket)
28from waeup.sirp.testing import FunctionalLayer, FunctionalTestCase
29
30class StudentTest(FunctionalTestCase):
31
32    layer = FunctionalLayer
33
34    def setUp(self):
35        super(StudentTest, self).setUp()
36        self.student = Student()
37        self.studycourse = StudentStudyCourse()
38        self.studylevel = StudentStudyLevel()
39        self.courseticket = CourseTicket()
40        self.payments = StudentPaymentsContainer()
41        self.accommodation = StudentAccommodation()
42        self.bedticket = BedTicket()
43        return
44
45    def tearDown(self):
46        super(StudentTest, self).tearDown()
47        return
48
49    def test_interfaces(self):
50        verify.verifyClass(IStudent, Student)
51        verify.verifyObject(IStudent, self.student)
52        verify.verifyClass(IStudentStudyCourse, StudentStudyCourse)
53        verify.verifyObject(IStudentStudyCourse, self.studycourse)
54        verify.verifyObject(IStudentStudyLevel, self.studylevel)
55        verify.verifyObject(ICourseTicket, self.courseticket)
56        verify.verifyClass(IStudentPaymentsContainer, StudentPaymentsContainer)
57        verify.verifyObject(IStudentPaymentsContainer, self.payments)
58        verify.verifyClass(IStudentAccommodation, StudentAccommodation)
59        verify.verifyObject(IStudentAccommodation, self.accommodation)
60        verify.verifyClass(IBedTicket, BedTicket)
61        verify.verifyObject(IBedTicket, self.bedticket)
62        return
63
64class StudentFactoryTest(FunctionalTestCase):
65
66    layer = FunctionalLayer
67
68    def setUp(self):
69        super(StudentFactoryTest, self).setUp()
70        self.factory = StudentFactory()
71
72    def tearDown(self):
73        super(StudentFactoryTest, self).tearDown()
74
75    def test_interfaces(self):
76        verify.verifyClass(IFactory, StudentFactory)
77        verify.verifyObject(IFactory, self.factory)
78
79    def test_factory(self):
80        obj = self.factory()
81        assert isinstance(obj, Student)
82
83    def test_getInterfaces(self):
84        implemented_by = self.factory.getInterfaces()
85        assert implemented_by.isOrExtends(IStudent)
Note: See TracBrowser for help on using the repository browser.