source: main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_interfaces.py @ 16231

Last change on this file since 16231 was 10208, checked in by Henrik Bettermann, 12 years ago

Move resultset post-processing to filterCertificates method.

  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1## $Id: test_interfaces.py 10208 2013-05-23 05:39:45Z henrik $
2##
3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18"""
19Test components defined in interface module.
20"""
21import unittest
22from zc.sourcefactory.browser.source import FactoredTerms
23from zope.publisher.browser import TestRequest
24from waeup.kofa.students.vocabularies import GenderSource
25
26class InterfacesTest(unittest.TestCase):
27
28    def setUp(self):
29        self.source = GenderSource()
30        self.request = TestRequest()
31        self.terms = FactoredTerms(self.source, self.request)
32        return
33
34    def tearDown(self):
35        pass
36
37    def test_GenderSource_list(self):
38        result = list(self.source)
39        self.assertEqual(result, ['m', 'f'])
40
41    def test_GenderSource_term_male(self):
42        term = self.terms.getTerm('m')
43        assert term.title == 'male'
44        assert term.token == 'm'
45        assert term.value == 'm'
46
47    def test_GenderSource_term_female(self):
48        term = self.terms.getTerm('f')
49        assert term.title == 'female'
50        assert term.token == 'f'
51        assert term.value == 'f'
52
53    def test_GernderSource_term_invalid(self):
54        term_inv = self.terms.getTerm('Invalid')
55        assert term_inv.title is None
56        assert term_inv.token == 'i'
57
58def suite():
59    suite = unittest.TestSuite()
60    for testcase in [
61            InterfacesTest,
62            ]:
63        suite.addTests(unittest.TestLoader().loadTestsFromTestCase(testcase))
64    return suite
65
66test_suite = suite
67
68
Note: See TracBrowser for help on using the repository browser.