source: main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_students.py @ 6626

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

Remove old student package and replace by new students package which even contains the first browser UIs (fully tested)

  • Property svn:keywords set to Id
File size: 2.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"""
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.students import (
30    Student, StudentFactory,
31    )
32from waeup.sirp.students.interfaces import (
33    IStudent,
34    )
35from waeup.sirp.testing import FunctionalLayer
36
37class StudentTest(FunctionalTestCase):
38
39    layer = FunctionalLayer
40
41    def setUp(self):
42        super(StudentTest, self).setUp()
43        self.student = Student()
44        return
45
46    def tearDown(self):
47        super(StudentTest, self).tearDown()
48        return
49
50    def test_interfaces(self):
51        verify.verifyClass(IStudent, Student)
52        verify.verifyObject(IStudent, self.student)
53        return
54
55class StudentFactoryTest(FunctionalTestCase):
56
57    layer = FunctionalLayer
58
59    def setUp(self):
60        self.factory = StudentFactory()
61
62    def tearDown(self):
63        pass
64
65    def test_interfaces(self):
66        verify.verifyClass(IFactory, StudentFactory)
67        verify.verifyObject(IFactory, self.factory)
68
69    def test_factory(self):
70        obj = self.factory()
71        assert isinstance(obj, Student)
72
73    def test_getInterfaces(self):
74        implemented_by = self.factory.getInterfaces()
75        assert implemented_by.isOrExtends(IStudent)
Note: See TracBrowser for help on using the repository browser.