Changeset 14170 for main/waeup.kofa/trunk/src/waeup/kofa/browser/tests
- Timestamp:
- 20 Sep 2016, 11:35:42 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/test_browser.py
r14166 r14170 24 24 import os 25 25 import grok 26 from datetime import datetime, timedelta 26 27 from zc.async.testing import wait_for_result 27 28 from zope.component import createObject, getUtility … … 32 33 from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase 33 34 from waeup.kofa.app import University 34 from waeup.kofa.interfaces import IJobManager, IUserAccount 35 from waeup.kofa.interfaces import IJobManager, IUserAccount, IKofaUtils 35 36 from waeup.kofa.tests.test_async import FunctionalAsyncTestCase 36 37 from waeup.kofa.university.faculty import Faculty … … 435 436 # we can discard a generated export result 436 437 self.trigger_export() 437 self.wait_for_export_job_completed()438 job_id = self.wait_for_export_job_completed() 438 439 self.browser.open(self.datacenter_path + '/@@export') 439 440 self.browser.getControl("Discard").click() … … 443 444 logcontent = open(logfile).read() 444 445 self.assertTrue( 445 'zope.mgr - browser.pages.ExportCSVPage - discarded: job_id=' 446 in logcontent) 446 'zope.mgr - browser.pages.ExportCSVPage - discarded: job_id=%s' 447 % job_id in logcontent) 448 return 449 450 def test_export_purge(self): 451 self.trigger_export() 452 job_id = self.wait_for_export_job_completed() 453 self.browser.open(self.datacenter_path + '/export') 454 self.browser.getControl("Purge").click() 455 # Flash message always says successful ... 456 self.assertTrue( 457 'Exports successfully purged.' in self.browser.contents) 458 # ... but the export is still there 459 self.assertEqual(len(self.app['datacenter'].running_exports), 1) 460 461 job_id, gen_name, user = self.app['datacenter'].get_running_export_jobs()[0] 462 job = getUtility(IJobManager).get(job_id) 463 tz = getUtility(IKofaUtils).tzinfo 464 delta = timedelta(days=5) 465 setattr(job, '_begin_after', datetime.now(tz) - delta) 466 self.browser.getControl("Purge").click() 467 self.assertEqual(len(self.app['datacenter'].running_exports), 0) 468 logfile = os.path.join( 469 self.app['datacenter'].storage, 'logs', 'datacenter.log') 470 logcontent = open(logfile).read() 471 self.assertTrue('zope.mgr - browser.pages.ExportCSVPage - ' 472 'purged: job_id=%s' % job_id in logcontent) 447 473 return 448 474
Note: See TracChangeset for help on using the changeset viewer.