source: main/waeup.sirp/branches/ulif-groktoolkit-1.4/src/waeup/sirp/applicants/tests/test_interfaces.py @ 7712

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

Merge the vocabularies module with the interfaces module. I don't see any other way to avoid conflicting imports since we have now IApplicantsUtils defined in interfaces and needed in vocabularies.

  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1## $Id: test_interfaces.py 7683 2012-02-23 07:43:06Z 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.sirp.applicants.interfaces import ApplicationTypeSource
25from waeup.sirp.students.vocabularies import GenderSource
26
27class InterfacesTest(unittest.TestCase):
28
29    def setUp(self):
30        self.source = GenderSource()
31        self.request = TestRequest()
32        self.terms = FactoredTerms(self.source, self.request)
33        return
34
35    def tearDown(self):
36        pass
37
38    def test_GenderSource_list(self):
39        result = list(self.source)
40        self.assertEqual(result, ['m', 'f'])
41
42    def test_GenderSource_term_male(self):
43        term = self.terms.getTerm('m')
44        assert term.title == 'Male'
45        assert term.token == 'm'
46        assert term.value == 'm'
47
48    def test_GenderSource_term_female(self):
49        term = self.terms.getTerm('f')
50        assert term.title == 'Female'
51        assert term.token == 'f'
52        assert term.value == 'f'
53
54    def test_GernderSource_term_invalid(self):
55        term_inv = self.terms.getTerm('Invalid')
56        assert term_inv.title is None
57        assert term_inv.token == 'i'
58
59def suite():
60    suite = unittest.TestSuite()
61    for testcase in [
62            InterfacesTest,
63            ]:
64        suite.addTests(unittest.TestLoader().loadTestsFromTestCase(testcase))
65    return suite
66
67test_suite = suite
68
69
Note: See TracBrowser for help on using the repository browser.