source: main/waeup.sirp/branches/ulif-images/src/waeup/sirp/jambtables/tests/test_util.py @ 11078

Last change on this file since 11078 was 5466, checked in by uli, 14 years ago

Add tests for jambtable utils.

File size: 2.1 KB
Line 
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"""
24import unittest
25from zope.component.hooks import setSite
26from zope.site import LocalSiteManager
27from zope.site.folder import Folder
28from zope.site.testing import siteSetUp, siteTearDown
29from waeup.sirp.jambtables.tests.test_authentication import (
30    FakeSite)
31from waeup.sirp.jambtables.util import application_exists, get_applicant_data
32
33class HelperToolsTest(unittest.TestCase):
34
35    def setUp(self):
36        self.root = Folder()
37        siteSetUp(self.root)
38        self.app = FakeSite() #grok.Application()
39        self.root['app'] = self.app
40        self.app.setSiteManager(LocalSiteManager(self.app))
41        setSite(self.app)
42        return
43
44    def tearDown(self):
45        siteTearDown()
46        return
47
48    def test_application_exists(self):
49        result = application_exists('APP-99999')
50        assert result is False
51
52        result = application_exists('APP-44444')
53        assert result is True
54       
55        return
56
57def test_suite():
58    suite = unittest.TestSuite()
59    for testcase in [
60        HelperToolsTest,
61        ]:
62        suite.addTest(unittest.TestLoader().loadTestsFromTestCase(
63                testcase
64                )
65        )
66    return suite
Note: See TracBrowser for help on using the repository browser.