source: main/waeup.ikoba/trunk/src/waeup/ikoba/tests/test_app.py @ 17664

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

Remove tools.

rename institution company.

Remove some apis from docs.

  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1## $Id: test_app.py 11954 2014-11-13 16:54:17Z 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 Company
25from waeup.ikoba.interfaces import (
26    ICompany, IJobManager, VIRT_JOBS_CONTAINER_NAME)
27from waeup.ikoba.testing import FunctionalLayer, FunctionalTestCase
28
29class CompanyTests(FunctionalTestCase):
30
31    layer = FunctionalLayer
32
33    def setUp(self):
34        super(CompanyTests, self).setUp()
35        self.workdir = tempfile.mkdtemp()
36        self.getRootFolder()['app'] = Company()
37        self.app = self.getRootFolder()['app']
38        return
39
40    def tearDown(self):
41        super(CompanyTests, self).tearDown()
42        shutil.rmtree(self.workdir)
43        return
44
45    def test_ifaces(self):
46        company = Company()
47        assert verifyClass(ICompany, Company)
48        assert verifyObject(ICompany, company)
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.