source: main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/tests/test_app.py @ 11949

Last change on this file since 11949 was 11949, checked in by Henrik Bettermann, 10 years ago

Change of name.

  • Property svn:keywords set to Id
File size: 2.3 KB
Line 
1## $Id: test_app.py 11949 2014-11-13 14:40:27Z 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##
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.ikoba.app import University
25from waeup.ikoba.interfaces import (
26    IUniversity, IJobManager, VIRT_JOBS_CONTAINER_NAME)
27from waeup.ikoba.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_jobs(self):
60        # We can get the global job manager when traversing to it...
61        result = self.app.traverse(VIRT_JOBS_CONTAINER_NAME)
62        self.assertTrue(IJobManager.providedBy(result))
63        return
Note: See TracBrowser for help on using the repository browser.