Changeset 14169 for main/waeup.kofa/trunk/src/waeup/kofa/students/reports
- Timestamp:
- 20 Sep 2016, 08:33:44 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_student_statistics.py
r12897 r14169 1 1 # Tests for student 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.kofa.interfaces import IJobManager 7 from waeup.kofa.interfaces import IJobManager, IKofaUtils 7 8 from waeup.kofa.students.reports.student_statistics import ( 8 9 get_student_stats, StudentStatisticsReport, IStudentStatisticsReport) … … 207 208 ) 208 209 return 210 211 def test_report_purge(self): 212 self.trigger_report_creation() 213 job_id = self.wait_for_report_job_completed() 214 self.browser.open('http://localhost/app/reports') 215 self.browser.getControl("Purge").click() 216 self.assertTrue('0 report(s) purged' in self.browser.contents) 217 job_id, gen_name, user = self.app['reports'].get_running_report_jobs(user_id=None)[0] 218 job = getUtility(IJobManager).get(job_id) 219 tz = getUtility(IKofaUtils).tzinfo 220 delta = timedelta(weeks=5) 221 setattr(job, '_begin_after', datetime.now(tz) - delta) 222 self.browser.getControl("Purge").click() 223 self.assertTrue('1 report(s) purged' in self.browser.contents) 224 logfile = os.path.join( 225 self.app['datacenter'].storage, 'logs', 'main.log') 226 logcontent = open(logfile).read() 227 self.assertTrue( 228 'INFO - zope.mgr - browser.reports.ReportsContainerPage - ' 229 'report %s purged' % job_id in logcontent 230 ) 231 return
Note: See TracChangeset for help on using the changeset viewer.