- Timestamp:
- 22 Sep 2016, 19:43:09 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/reports/tests/test_contract_statistics.py
r12663 r14173 1 1 # Tests for contract related reports 2 2 import os 3 from datetime import datetime, timedelta 3 4 from zc.async.testing import wait_for_result 4 5 from zope.interface.verify import verifyClass, verifyObject 5 6 from zope.component import getUtility 6 from waeup.ikoba.interfaces import IJobManager 7 from waeup.ikoba.interfaces import IJobManager, IIkobaUtils 7 8 from waeup.ikoba.customers.reports.contract_statistics import ( 8 9 get_contract_stats, ContractStatisticsReport, IContractStatisticsReport) … … 118 119 ) 119 120 return 121 122 def test_report_purge(self): 123 self.trigger_report_creation() 124 job_id = self.wait_for_report_job_completed() 125 self.browser.open('http://localhost/app/reports') 126 self.browser.getControl("Purge").click() 127 self.assertTrue('0 report(s) purged' in self.browser.contents) 128 job_id, gen_name, user = self.app['reports'].get_running_report_jobs(user_id=None)[0] 129 job = getUtility(IJobManager).get(job_id) 130 tz = getUtility(IIkobaUtils).tzinfo 131 delta = timedelta(weeks=5) 132 setattr(job, '_begin_after', datetime.now(tz) - delta) 133 self.browser.getControl("Purge").click() 134 self.assertTrue('1 report(s) purged' in self.browser.contents) 135 logfile = os.path.join( 136 self.app['datacenter'].storage, 'logs', 'main.log') 137 logcontent = open(logfile).read() 138 self.assertTrue( 139 'INFO - zope.mgr - browser.reports.ReportsContainerPage - ' 140 'report %s purged' % job_id in logcontent 141 ) 142 return
Note: See TracChangeset for help on using the changeset viewer.