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

Last change on this file since 7125 was 7063, checked in by uli, 13 years ago

Merge changes from branch ulif-extimgstore back into trunk.
Beside external image storage also waeupdocs should work again.

File size: 1.4 KB
Line 
1import tempfile
2import shutil
3from hurry.file.interfaces import IFileRetrieval
4from zope.component import queryUtility
5from zope.component.hooks import setSite
6from zope.interface.verify import verifyClass, verifyObject
7from waeup.sirp.app import University
8from waeup.sirp.interfaces import IUniversity
9from waeup.sirp.testing import FunctionalLayer, FunctionalTestCase
10
11class UniversityTests(FunctionalTestCase):
12
13    layer = FunctionalLayer
14
15    def setUp(self):
16        super(UniversityTests, self).setUp()
17        self.workdir = tempfile.mkdtemp()
18        self.getRootFolder()['app'] = University()
19        self.app = self.getRootFolder()['app']
20        return
21
22    def tearDown(self):
23        super(UniversityTests, self).tearDown()
24        shutil.rmtree(self.workdir)
25        return
26
27    def test_ifaces(self):
28        university = University()
29        assert verifyClass(IUniversity, University)
30        assert verifyObject(IUniversity, university)
31        return
32
33    def test_IFileRetrieval_utility(self):
34        # Make sure we can get a local IFileRetrieval utility
35        setSite(self.app)
36        result = queryUtility(IFileRetrieval, default=None)
37        assert result is not None
38        assert IFileRetrieval.providedBy(result)
39        return
40
41    def test_update_plugins(self):
42        # We can update plugins
43        setSite(self.app)
44        del self.app['accesscodes']
45        self.app.updatePlugins()
46        self.assertTrue('accesscodes' in self.app.keys())
Note: See TracBrowser for help on using the repository browser.