Changeset 6120 for main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests
- Timestamp:
- 16 May 2011, 17:21:12 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_root.py
r5867 r6120 24 24 """ 25 25 import logging 26 import shutil 27 import tempfile 26 28 import unittest 27 29 from StringIO import StringIO 30 from zope.app.testing.functional import FunctionalTestCase 28 31 from zope.component.hooks import setSite, clearSite 29 32 from zope.interface.verify import verifyClass, verifyObject … … 37 40 ApplicantsRoot, ApplicantsPlugin, 38 41 ) 39 from waeup.sirp.testing import WAeUPSIRPUnitTestLayer 42 from waeup.sirp.testing import FunctionalLayer 43 44 40 45 41 46 … … 149 154 return 150 155 151 applicant = Applicant() 152 fake_apps = { 153 'cest10' : ApplicantsContainer(), 154 'cest11' : ApplicantsContainer(), 155 } 156 157 fake_apps['cest10']['APP-99999'] = applicant 158 159 class HelperToolsTest(unittest.TestCase): 160 161 layer = WAeUPSIRPUnitTestLayer 162 156 157 class HelperToolsTest(FunctionalTestCase): 158 159 layer = FunctionalLayer 160 163 161 def setUp(self): 164 self.app = University() 165 # Insert some applicants... 166 for container, data in fake_apps.items(): 167 self.app['applicants'][container] = data 168 self.app.setSiteManager(LocalSiteManager(self.app)) 162 super(HelperToolsTest, self).setUp() 163 164 # Setup a sample site for each test 165 app = University() 166 self.dc_root = tempfile.mkdtemp() 167 app['datacenter'].setStoragePath(self.dc_root) 168 169 # Prepopulate the ZODB... 170 self.getRootFolder()['app'] = app 171 self.app = self.getRootFolder()['app'] 169 172 setSite(self.app) 173 174 # Insert some applicants containers and applicants... 175 self.container1 = ApplicantsContainer() 176 self.app['applicants']['foo'] = self.container1 177 self.container2 = ApplicantsContainer() 178 self.app['applicants']['bar'] = self.container2 179 self.ac = u'APP-99999' 180 self.applicant = Applicant() 181 self.applicant.access_code = self.ac 182 self.app['applicants']['foo'][self.ac] = self.applicant 170 183 return 171 184 172 185 def tearDown(self): 173 clearSite() 186 super(HelperToolsTest, self).tearDown() 187 shutil.rmtree(self.dc_root) 174 188 return 175 189 … … 184 198 def test_get_applicant_data(self): 185 199 result = get_applicant_data('APP-99999') 186 self.assertEqual(result, applicant)200 self.assertEqual(result, self.applicant) 187 201 return 188 202 … … 191 205 assert result is None 192 206 return 193 207 194 208 def suite(): 195 209 suite = unittest.TestSuite()
Note: See TracChangeset for help on using the changeset viewer.