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

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

Copy all data from the course and its course referrer into course tickets.

A course ticket contains a copy of the original course and
course referrer data. If the courses and/or their referrers are removed, the
corresponding tickets remain unchanged. So we do not need any event
triggered actions on course ticket.

  • 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 StudentPayments
24from waeup.sirp.students.accommodation import StudentAccommodation
25from waeup.sirp.students.interfaces import (
26    IStudent, IStudentStudyCourse, IStudentPayments, 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('CERT', 'Title', 100, 10, 40, 1,
40            'Faculty', 'Department', True)
41        self.payments = StudentPayments()
42        self.accommodation = StudentAccommodation()
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(IStudentPayments, StudentPayments)
57        verify.verifyObject(IStudentPayments, self.payments)
58        verify.verifyClass(IStudentAccommodation, StudentAccommodation)
59        verify.verifyObject(IStudentAccommodation, self.accommodation)
60        return
61
62class StudentFactoryTest(FunctionalTestCase):
63
64    layer = FunctionalLayer
65
66    def setUp(self):
67        super(StudentFactoryTest, self).setUp()
68        self.factory = StudentFactory()
69
70    def tearDown(self):
71        super(StudentFactoryTest, self).tearDown()
72
73    def test_interfaces(self):
74        verify.verifyClass(IFactory, StudentFactory)
75        verify.verifyObject(IFactory, self.factory)
76
77    def test_factory(self):
78        obj = self.factory()
79        assert isinstance(obj, Student)
80
81    def test_getInterfaces(self):
82        implemented_by = self.factory.getInterfaces()
83        assert implemented_by.isOrExtends(IStudent)
Note: See TracBrowser for help on using the repository browser.