source: main/waeup.sirp/trunk/src/waeup/sirp/tests/test_app.py @ 7235

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

More copyright adjustments.

  • Property svn:keywords set to Id
File size: 2.2 KB
RevLine 
[7193]1## $Id: test_app.py 7193 2011-11-25 07:21:29Z 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##
[6523]18import tempfile
19import shutil
20from hurry.file.interfaces import IFileRetrieval
21from zope.component import queryUtility
[6532]22from zope.component.hooks import setSite
[6523]23from zope.interface.verify import verifyClass, verifyObject
24from waeup.sirp.app import University
25from waeup.sirp.interfaces import IUniversity
26from waeup.sirp.testing import FunctionalLayer, FunctionalTestCase
27
28class UniversityTests(FunctionalTestCase):
29
30    layer = FunctionalLayer
31
32    def setUp(self):
33        super(UniversityTests, self).setUp()
34        self.workdir = tempfile.mkdtemp()
35        self.getRootFolder()['app'] = University()
36        self.app = self.getRootFolder()['app']
37        return
38
39    def tearDown(self):
40        super(UniversityTests, self).tearDown()
41        shutil.rmtree(self.workdir)
42        return
43
44    def test_ifaces(self):
45        university = University()
46        assert verifyClass(IUniversity, University)
47        assert verifyObject(IUniversity, university)
48        return
49
50    def test_IFileRetrieval_utility(self):
51        # Make sure we can get a local IFileRetrieval utility
52        setSite(self.app)
53        result = queryUtility(IFileRetrieval, default=None)
54        assert result is not None
55        assert IFileRetrieval.providedBy(result)
56        return
[6593]57
58    def test_update_plugins(self):
59        # We can update plugins
60        setSite(self.app)
61        del self.app['accesscodes']
62        self.app.updatePlugins()
63        self.assertTrue('accesscodes' in self.app.keys())
Note: See TracBrowser for help on using the repository browser.