1 | ## |
---|
2 | ## test_util.py |
---|
3 | ## Login : <uli@pu.smp.net> |
---|
4 | ## Started on Sun Aug 22 19:56:52 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 jambtables and applicants helper tools. |
---|
23 | """ |
---|
24 | import unittest |
---|
25 | from zope.component.hooks import setSite |
---|
26 | from zope.site import LocalSiteManager |
---|
27 | from zope.site.folder import Folder |
---|
28 | from zope.site.testing import siteSetUp, siteTearDown |
---|
29 | from waeup.sirp.applicants.jambtables.tests.test_authentication import ( |
---|
30 | FakeSite) |
---|
31 | from waeup.sirp.applicants.jambtables.util import ( |
---|
32 | application_exists, get_applicant_data |
---|
33 | ) |
---|
34 | |
---|
35 | class HelperToolsTest(unittest.TestCase): |
---|
36 | |
---|
37 | def setUp(self): |
---|
38 | self.root = Folder() |
---|
39 | siteSetUp(self.root) |
---|
40 | self.app = FakeSite() #grok.Application() |
---|
41 | self.root['app'] = self.app |
---|
42 | self.app.setSiteManager(LocalSiteManager(self.app)) |
---|
43 | setSite(self.app) |
---|
44 | return |
---|
45 | |
---|
46 | def tearDown(self): |
---|
47 | siteTearDown() |
---|
48 | return |
---|
49 | |
---|
50 | def test_application_exists(self): |
---|
51 | result = application_exists('APP-99999') |
---|
52 | assert result is False |
---|
53 | |
---|
54 | result = application_exists('APP-44444') |
---|
55 | assert result is True |
---|
56 | |
---|
57 | return |
---|
58 | |
---|
59 | def test_suite(): |
---|
60 | suite = unittest.TestSuite() |
---|
61 | for testcase in [ |
---|
62 | HelperToolsTest, |
---|
63 | ]: |
---|
64 | suite.addTest(unittest.TestLoader().loadTestsFromTestCase( |
---|
65 | testcase |
---|
66 | ) |
---|
67 | ) |
---|
68 | return suite |
---|