- Timestamp:
- 2 Sep 2013, 11:45:45 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_session_results_presentation.py
r10577 r10579 83 83 return False 84 84 85 def trigger_report_creation(self ):85 def trigger_report_creation(self, level='100'): 86 86 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 87 87 self.browser.open('http://localhost/app/reports') … … 90 90 self.browser.getControl(name="generator").value = ['session_results_presentation'] 91 91 self.browser.getControl("Configure").click() 92 self.browser.getControl(name="level").value = [ '100']92 self.browser.getControl(name="level").value = [level] 93 93 self.browser.getControl(name="session").value = ['2010'] 94 94 self.browser.getControl(name="faccode_depcode").value = ['fac1_dep1'] … … 133 133 'report %s discarded' % job_id in logcontent 134 134 ) 135 135 136 return 137 138 def test_report_download_all_levels(self): 139 # We can download a generated report for all levels 140 self.trigger_report_creation(level='all') 141 # When the job is finished and we reload the page... 142 job_id = self.wait_for_report_job_completed() 143 self.browser.open('http://localhost/app/reports') 144 # ... the pdf file can be downloaded ... 145 self.browser.getControl("Download").click() 146 self.assertEqual(self.browser.headers['content-type'], 147 'application/pdf') 148 self.assertTrue( 149 'filename="SessionResultsPresentation_fac1_dep1_2010_None_' in 150 self.browser.headers['content-disposition']) 151 self.assertEqual(len(self.app['reports'].running_report_jobs), 1) 152 job_id = self.app['reports'].running_report_jobs[0][0] 153 # ... and discarded 154 self.browser.open('http://localhost/app/reports') 155 self.browser.getControl("Discard").click() 156 self.assertEqual(len(self.app['reports'].running_report_jobs), 0) 157 # Creation, downloading and discarding is logged 158 logfile = os.path.join( 159 self.app['datacenter'].storage, 'logs', 'main.log') 160 logcontent = open(logfile).read() 161 self.assertTrue( 162 'INFO - zope.mgr - students.reports.session_results_presentation.SessionResultsPresentationGeneratorPage - ' 163 'report %s created: Session Results Presentation (faculty=fac1, department=dep1, session=2010, level=None)' 164 % job_id in logcontent 165 ) 166 self.assertTrue( 167 'INFO - zope.mgr - students.reports.session_results_presentation.SessionResultsPresentationPDFView - ' 168 'report %s downloaded: SessionResultsPresentation_fac1_dep1_2010_None_' 169 % job_id in logcontent 170 ) 171 self.assertTrue( 172 'INFO - zope.mgr - browser.reports.ReportsContainerPage - ' 173 'report %s discarded' % job_id in logcontent 174 ) 175 176 return
Note: See TracChangeset for help on using the changeset viewer.