Changeset 9342 for main/waeup.kofa/trunk/src/waeup/kofa/testing.py
- Timestamp:
- 16 Oct 2012, 09:42:18 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/testing.py
r9289 r9342 29 29 import zope.component 30 30 import waeup.kofa 31 from zc.async.interfaces import COMPLETED 31 32 from zope.app.testing.functional import ( 32 33 ZCMLLayer, FunctionalTestSetup, getRootFolder, sync, FunctionalTestCase) … … 430 431 suite.addTest(test) 431 432 return suite 433 434 class FakeJob(object): 435 # A job usable for simple async tests 436 status = COMPLETED 437 result = None 438 439 class FakeJobManager(object): 440 # A fake job manager for testing async functionality 441 _jobs = dict() 442 _curr_num = 1 443 444 def get(self, job_id): 445 if job_id == '3': 446 return FakeJob() 447 return self._jobs.get(job_id, None) 448 449 def put(self, job): 450 num = str(self._curr_num) 451 self._jobs[num] = job 452 self._curr_num += 1 453 return num 454 455 def remove(self, job_id, site): 456 if job_id in self._jobs: 457 del self._jobs[job_id] 458 return
Note: See TracChangeset for help on using the changeset viewer.