Changeset 6414 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 20 Jun 2011, 00:54:45 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/tests/test_accesscodes.py
r6413 r6414 23 23 import tempfile 24 24 import unittest 25 from datetime import datetime 25 26 from hurry.workflow.interfaces import InvalidTransitionError, IWorkflowState 26 27 from zope.app.testing.functional import FunctionalTestCase 27 28 from zope.component.hooks import setSite, clearSite 29 from zope.interface.verify import verifyObject, verifyClass 28 30 from waeup.sirp.app import University 29 31 from waeup.sirp.testing import FunctionalLayer 30 32 from waeup.sirp.accesscodes.accesscodes import ( 31 AccessCodeBatch, get_access_code, invalidate_accesscode, 32 disable_accesscode, reenable_accesscode, fire_transition) 33 AccessCodeBatch, get_access_code, invalidate_accesscode, AccessCode, 34 disable_accesscode, reenable_accesscode, fire_transition, 35 AccessCodeBatchContainer,) 36 from waeup.sirp.accesscodes.interfaces import ( 37 IAccessCode, IAccessCodeBatch, IAccessCodeBatchContainer,) 33 38 from waeup.sirp.accesscodes.workflow import INITIALIZED, USED, DISABLED 34 39 … … 165 170 fire_transition, 'APP-1-11111111', 'init') # already initialized 166 171 172 173 class AccessCodeTests(FunctionalTestCase): 174 # Tests for AccessCode class 175 176 layer = FunctionalLayer 177 178 def setUp(self): 179 super(AccessCodeTests, self).setUp() 180 181 # Prepopulate ZODB 182 app = University() 183 self.dc_root = tempfile.mkdtemp() 184 app['datacenter'].setStoragePath(self.dc_root) 185 186 # Prepopulate the ZODB... 187 self.getRootFolder()['app'] = app 188 self.app = self.getRootFolder()['app'] 189 190 setSite(self.app) 191 return 192 193 def tearDown(self): 194 shutil.rmtree(self.dc_root) 195 super(AccessCodeTests, self).tearDown() 196 return 197 198 def test_iface(self): 199 ac = AccessCode('1', '12345678') 200 assert verifyObject(IAccessCode, ac) 201 assert verifyClass(IAccessCode, AccessCode) 202 203 class AccessCodeBatchTests(FunctionalTestCase): 204 # Tests for AccessCodeBatch class 205 206 layer = FunctionalLayer 207 208 def setUp(self): 209 super(AccessCodeBatchTests, self).setUp() 210 211 # Prepopulate ZODB 212 app = University() 213 self.dc_root = tempfile.mkdtemp() 214 app['datacenter'].setStoragePath(self.dc_root) 215 216 # Prepopulate the ZODB... 217 self.getRootFolder()['app'] = app 218 self.app = self.getRootFolder()['app'] 219 220 setSite(self.app) 221 return 222 223 def tearDown(self): 224 shutil.rmtree(self.dc_root) 225 super(AccessCodeBatchTests, self).tearDown() 226 return 227 228 def test_iface(self): 229 batch = AccessCodeBatch( 230 datetime(2009, 12, 23), 'Fred','APP', 12.12, 3, num=10) 231 assert verifyObject(IAccessCodeBatch, batch) 232 assert verifyClass(IAccessCodeBatch, AccessCodeBatch) 233 234 class AccessCodeBatchContainerTests(FunctionalTestCase): 235 # Tests for AccessCodeContainer class 236 237 layer = FunctionalLayer 238 239 def setUp(self): 240 super(AccessCodeBatchContainerTests, self).setUp() 241 242 # Prepopulate ZODB 243 app = University() 244 self.dc_root = tempfile.mkdtemp() 245 app['datacenter'].setStoragePath(self.dc_root) 246 247 # Prepopulate the ZODB... 248 self.getRootFolder()['app'] = app 249 self.app = self.getRootFolder()['app'] 250 251 setSite(self.app) 252 return 253 254 def tearDown(self): 255 shutil.rmtree(self.dc_root) 256 super(AccessCodeBatchContainerTests, self).tearDown() 257 return 258 259 def test_iface(self): 260 accesscodes = AccessCodeBatchContainer() 261 assert verifyObject(IAccessCodeBatchContainer, accesscodes) 262 assert verifyClass(IAccessCodeBatchContainer, AccessCodeBatchContainer)
Note: See TracChangeset for help on using the changeset viewer.