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

Last change on this file since 6634 was 6633, checked in by Henrik Bettermann, 14 years ago

We don't need a factory for StudentsContainer?.

Add addStudent method which automatically creates subcontainers.

Add StudentStudyCourse? container class which holds the study course data and contains student study level objects for course registration.

  • Property svn:keywords set to Id
File size: 2.6 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 (
33    StudentStudyCourse,
34    )
35from waeup.sirp.students.interfaces import (
36    IStudent, IStudentStudyCourse,
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        return
49
50    def tearDown(self):
51        super(StudentTest, self).tearDown()
52        return
53
54    def test_interfaces(self):
55        verify.verifyClass(IStudent, Student)
56        verify.verifyObject(IStudent, self.student)
57        verify.verifyClass(IStudentStudyCourse, StudentStudyCourse)
58        verify.verifyObject(IStudentStudyCourse, self.studycourse)
59        return
60
61class StudentFactoryTest(FunctionalTestCase):
62
63    layer = FunctionalLayer
64
65    def setUp(self):
66        self.factory = StudentFactory()
67
68    def tearDown(self):
69        pass
70
71    def test_interfaces(self):
72        verify.verifyClass(IFactory, StudentFactory)
73        verify.verifyObject(IFactory, self.factory)
74
75    def test_factory(self):
76        obj = self.factory()
77        assert isinstance(obj, Student)
78
79    def test_getInterfaces(self):
80        implemented_by = self.factory.getInterfaces()
81        assert implemented_by.isOrExtends(IStudent)
Note: See TracBrowser for help on using the repository browser.