Ignore:
Timestamp:
2 Sep 2013, 11:45:45 (11 years ago)
Author:
Henrik Bettermann
Message:

Enable report creation over all levels.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_session_results_presentation.py

    r10577 r10579  
    8383        return False
    8484
    85     def trigger_report_creation(self):
     85    def trigger_report_creation(self, level='100'):
    8686        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    8787        self.browser.open('http://localhost/app/reports')
     
    9090        self.browser.getControl(name="generator").value = ['session_results_presentation']
    9191        self.browser.getControl("Configure").click()
    92         self.browser.getControl(name="level").value = ['100']
     92        self.browser.getControl(name="level").value = [level]
    9393        self.browser.getControl(name="session").value = ['2010']
    9494        self.browser.getControl(name="faccode_depcode").value = ['fac1_dep1']
     
    133133            'report %s discarded' % job_id in logcontent
    134134            )
     135
    135136        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.