source: main/waeup.kofa/branches/uli-async-update/src/waeup/kofa/tests/test_app.py @ 9177

Last change on this file since 9177 was 9104, checked in by uli, 12 years ago

Make sure we can get the global jobs container when traversing a
University correctly.

  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1## $Id: test_app.py 9104 2012-08-09 10:17:04Z uli $
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##
18import tempfile
19import shutil
20from hurry.file.interfaces import IFileRetrieval
21from zope.component import queryUtility
22from zope.component.hooks import setSite
23from zope.interface.verify import verifyClass, verifyObject
24from waeup.kofa.app import University
25from waeup.kofa.interfaces import (
26    IUniversity, IJobManager, VIRT_JOBS_CONTAINER_NAME)
27from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase
28
29class UniversityTests(FunctionalTestCase):
30
31    layer = FunctionalLayer
32
33    def setUp(self):
34        super(UniversityTests, self).setUp()
35        self.workdir = tempfile.mkdtemp()
36        self.getRootFolder()['app'] = University()
37        self.app = self.getRootFolder()['app']
38        return
39
40    def tearDown(self):
41        super(UniversityTests, self).tearDown()
42        shutil.rmtree(self.workdir)
43        return
44
45    def test_ifaces(self):
46        university = University()
47        assert verifyClass(IUniversity, University)
48        assert verifyObject(IUniversity, university)
49        return
50
51    def test_IFileRetrieval_utility(self):
52        # Make sure we can get a local IFileRetrieval utility
53        setSite(self.app)
54        result = queryUtility(IFileRetrieval, default=None)
55        assert result is not None
56        assert IFileRetrieval.providedBy(result)
57        return
58
59    def test_update_plugins(self):
60        # We can update plugins
61        setSite(self.app)
62        del self.app['accesscodes']
63        self.app.updatePlugins()
64        self.assertTrue('accesscodes' in self.app.keys())
65        return
66
67    def test_jobs(self):
68        # We can get the global job manager when traversing to it...
69        result = self.app.traverse(VIRT_JOBS_CONTAINER_NAME)
70        self.assertTrue(IJobManager.providedBy(result))
71        return
Note: See TracBrowser for help on using the repository browser.