source: main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_applicants.py @ 5755

Last change on this file since 5755 was 5751, checked in by uli, 14 years ago

Fix some imports.

File size: 2.8 KB
Line 
1##
2## test_applicants.py
3## Login : <uli@pu.smp.net>
4## Started on  Tue Aug 24 04:36:11 2010 Uli Fouquet
5## $Id$
6##
7## Copyright (C) 2010 Uli Fouquet
8## This program is free software; you can redistribute it and/or modify
9## it under the terms of the GNU General Public License as published by
10## the Free Software Foundation; either version 2 of the License, or
11## (at your option) any later version.
12##
13## This program is distributed in the hope that it will be useful,
14## but WITHOUT ANY WARRANTY; without even the implied warranty of
15## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16## GNU General Public License for more details.
17##
18## You should have received a copy of the GNU General Public License
19## along with this program; if not, write to the Free Software
20## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21##
22"""Tests for applicants and related.
23"""
24import logging
25import unittest
26from StringIO import StringIO
27from zope.component.interfaces import IFactory
28from zope.interface import verify
29from waeup.sirp.interfaces import IWAeUPSIRPPluggable
30from waeup.sirp.applicants import (
31    ResultEntry, Applicant, ApplicantFactory,
32    )
33from waeup.sirp.applicants.interfaces import (
34    IResultEntry, IApplicant,
35    )
36
37class ResultEntryTest(unittest.TestCase):
38
39    def setUp(self):
40        self.result_entry = ResultEntry()
41        return
42
43    def tearDown(self):
44        pass
45
46    def test_interfaces(self):
47        verify.verifyClass(IResultEntry, ResultEntry)
48        verify.verifyObject(IResultEntry, self.result_entry)
49
50    def test_resultentry(self):
51        entry = ResultEntry('Some subject', 3.7)
52        assert entry.subject == 'Some subject'
53        assert entry.score == 3.7
54
55class ApplicantTest(unittest.TestCase):
56
57    def setUp(self):
58        self.applicant = Applicant()
59
60    def tearDown(self):
61        pass
62
63    def test_interfaces(self):
64        verify.verifyClass(IApplicant, Applicant)
65        verify.verifyObject(IApplicant, self.applicant)
66
67class ApplicantFactoryTest(unittest.TestCase):
68
69    def setUp(self):
70        self.factory = ApplicantFactory()
71
72    def tearDown(self):
73        pass
74
75    def test_interfaces(self):
76        verify.verifyClass(IFactory, ApplicantFactory)
77        verify.verifyObject(IFactory, self.factory)
78
79    def test_factory(self):
80        obj = self.factory()
81        assert isinstance(obj, Applicant)
82
83    def test_getInterfaces(self):
84        implemented_by = self.factory.getInterfaces()
85        assert implemented_by.isOrExtends(IApplicant)
86
87def test_suite():
88    suite = unittest.TestSuite()
89    for testcase in [
90        ResultEntryTest, ApplicantTest, ApplicantFactoryTest,
91        ApplicantContainerTest,
92        ]:
93        suite.addTest(unittest.TestLoader().loadTestsFromTestCase(
94                testcase
95                )
96        )
97    return suite
Note: See TracBrowser for help on using the repository browser.