## $Id: test_app.py 11954 2014-11-13 16:54:17Z henrik $ ## ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## import tempfile import shutil from hurry.file.interfaces import IFileRetrieval from zope.component import queryUtility from zope.component.hooks import setSite from zope.interface.verify import verifyClass, verifyObject from waeup.ikoba.app import Company from waeup.ikoba.interfaces import ( ICompany, IJobManager, VIRT_JOBS_CONTAINER_NAME) from waeup.ikoba.testing import FunctionalLayer, FunctionalTestCase class CompanyTests(FunctionalTestCase): layer = FunctionalLayer def setUp(self): super(CompanyTests, self).setUp() self.workdir = tempfile.mkdtemp() self.getRootFolder()['app'] = Company() self.app = self.getRootFolder()['app'] return def tearDown(self): super(CompanyTests, self).tearDown() shutil.rmtree(self.workdir) return def test_ifaces(self): company = Company() assert verifyClass(ICompany, Company) assert verifyObject(ICompany, company) return def test_IFileRetrieval_utility(self): # Make sure we can get a local IFileRetrieval utility setSite(self.app) result = queryUtility(IFileRetrieval, default=None) assert result is not None assert IFileRetrieval.providedBy(result) return def test_jobs(self): # We can get the global job manager when traversing to it... result = self.app.traverse(VIRT_JOBS_CONTAINER_NAME) self.assertTrue(IJobManager.providedBy(result)) return