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

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

Rename StudentPayments? to StudentPaymentsContainer?.

  • Property svn:keywords set to Id
File size: 3.2 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
25from waeup.sirp.students.interfaces import (
26    IStudent, IStudentStudyCourse, IStudentPaymentsContainer, IStudentAccommodation,
27    IStudentStudyLevel, ICourseTicket)
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        return
43
44    def tearDown(self):
45        super(StudentTest, self).tearDown()
46        return
47
48    def test_interfaces(self):
49        verify.verifyClass(IStudent, Student)
50        verify.verifyObject(IStudent, self.student)
51        verify.verifyClass(IStudentStudyCourse, StudentStudyCourse)
52        verify.verifyObject(IStudentStudyCourse, self.studycourse)
53        verify.verifyObject(IStudentStudyLevel, self.studylevel)
54        verify.verifyObject(ICourseTicket, self.courseticket)
55        verify.verifyClass(IStudentPaymentsContainer, StudentPaymentsContainer)
56        verify.verifyObject(IStudentPaymentsContainer, self.payments)
57        verify.verifyClass(IStudentAccommodation, StudentAccommodation)
58        verify.verifyObject(IStudentAccommodation, self.accommodation)
59        return
60
61class StudentFactoryTest(FunctionalTestCase):
62
63    layer = FunctionalLayer
64
65    def setUp(self):
66        super(StudentFactoryTest, self).setUp()
67        self.factory = StudentFactory()
68
69    def tearDown(self):
70        super(StudentFactoryTest, self).tearDown()
71
72    def test_interfaces(self):
73        verify.verifyClass(IFactory, StudentFactory)
74        verify.verifyObject(IFactory, self.factory)
75
76    def test_factory(self):
77        obj = self.factory()
78        assert isinstance(obj, Student)
79
80    def test_getInterfaces(self):
81        implemented_by = self.factory.getInterfaces()
82        assert implemented_by.isOrExtends(IStudent)
Note: See TracBrowser for help on using the repository browser.