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

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

Remove unused imports.

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