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

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

Make action buttons smaller on studentpage.

Add StudentAccommodation? container class which contains the accommodation objects.

Add StudentPayments? container class which contains the payments objects.

  • Property svn:keywords set to Id
File size: 3.1 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"""
18import unittest
19from StringIO import StringIO
20from zope.app.testing.functional import FunctionalTestCase
21from zope.component import (
22    provideAdapter, adapts, getGlobalSiteManager, provideUtility)
23from zope.component.hooks import setSite
24from zope.component.interfaces import IFactory
25from zope.interface import verify, implements
26from zope.location.interfaces import ILocation
27from zope.publisher.base import TestRequest
28from zope.publisher.interfaces import NotFound
29from waeup.sirp.students.student import (
30    Student, StudentFactory,
31    )
32from waeup.sirp.students.studycourse import StudentStudyCourse
33from waeup.sirp.students.payments import StudentPayments
34from waeup.sirp.students.accommodation import StudentAccommodation
35from waeup.sirp.students.interfaces import (
36    IStudent, IStudentStudyCourse, IStudentPayments, IStudentAccommodation,
37    )
38from waeup.sirp.testing import FunctionalLayer
39
40class StudentTest(FunctionalTestCase):
41
42    layer = FunctionalLayer
43
44    def setUp(self):
45        super(StudentTest, self).setUp()
46        self.student = Student()
47        self.studycourse = StudentStudyCourse()
48        self.payments = StudentPayments()
49        self.accommodation = StudentAccommodation()
50        return
51
52    def tearDown(self):
53        super(StudentTest, self).tearDown()
54        return
55
56    def test_interfaces(self):
57        verify.verifyClass(IStudent, Student)
58        verify.verifyObject(IStudent, self.student)
59        verify.verifyClass(IStudentStudyCourse, StudentStudyCourse)
60        verify.verifyObject(IStudentStudyCourse, self.studycourse)
61        verify.verifyClass(IStudentPayments, StudentPayments)
62        verify.verifyObject(IStudentPayments, self.payments)
63        verify.verifyClass(IStudentAccommodation, StudentAccommodation)
64        verify.verifyObject(IStudentAccommodation, self.accommodation)
65        return
66
67class StudentFactoryTest(FunctionalTestCase):
68
69    layer = FunctionalLayer
70
71    def setUp(self):
72        self.factory = StudentFactory()
73
74    def tearDown(self):
75        pass
76
77    def test_interfaces(self):
78        verify.verifyClass(IFactory, StudentFactory)
79        verify.verifyObject(IFactory, self.factory)
80
81    def test_factory(self):
82        obj = self.factory()
83        assert isinstance(obj, Student)
84
85    def test_getInterfaces(self):
86        implemented_by = self.factory.getInterfaces()
87        assert implemented_by.isOrExtends(IStudent)
Note: See TracBrowser for help on using the repository browser.