Ignore:
Timestamp:
8 Jan 2013, 11:38:14 (12 years ago)
Author:
Henrik Bettermann
Message:

Implement local student data exports in courses.

File:
1 edited

Legend:

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

    r9842 r9843  
    27982798        self.browser.getControl(name="session").value = ['2004']
    27992799        self.browser.getControl(name="level").value = ['100']
    2800         self.browser.getControl(name="mode").value = ['ug_ft']
    28012800        self.browser.getControl("Create CSV file").click()
    28022801
     
    28232822        self.assertTrue(
    28242823            'zope.mgr - students.browser.CertificateExportJobContainerJobConfig '
    2825             '- exported: students (2004, 100, ug_ft, None, CERT1), job_id=%s'
     2824            '- exported: students (2004, 100, None, None, CERT1), job_id=%s'
    28262825            % job_id in logcontent
    28272826            )
     
    28352834            '- discarded: job_id=%s' % job_id in logcontent
    28362835            )
     2836
     2837    def test_course_export(self):
     2838        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     2839        course1_path = 'http://localhost/app/faculties/fac1/dep1/courses/COURSE1'
     2840        self.browser.open(course1_path)
     2841        self.browser.getLink("Export student data").click()
     2842        self.browser.getControl("Configure new export").click()
     2843        self.browser.getControl(name="exporter").value = ['students']
     2844        self.browser.getControl(name="session").value = ['2004']
     2845        self.browser.getControl(name="level").value = ['100']
     2846        self.browser.getControl("Create CSV file").click()
     2847
     2848        # When the job is finished and we reload the page...
     2849        job_id = self.wait_for_export_job_completed()
     2850        self.browser.open(course1_path + '/exports')
     2851        # ... the csv file can be downloaded ...
     2852        self.browser.getLink("Download").click()
     2853        self.assertEqual(self.browser.headers['content-type'],
     2854            'text/csv; charset=UTF-8')
     2855        self.assertTrue(
     2856            'filename="WAeUP.Kofa_students_%s.csv' % job_id in
     2857            self.browser.headers['content-disposition'])
     2858        self.assertEqual(len(self.app['datacenter'].running_exports), 1)
     2859        job_id = self.app['datacenter'].running_exports[0][0]
     2860        # ... and discarded
     2861        self.browser.open(course1_path + '/exports')
     2862        self.browser.getControl("Discard").click()
     2863        self.assertEqual(len(self.app['datacenter'].running_exports), 0)
     2864        # Creation, downloading and discarding is logged
     2865        logfile = os.path.join(
     2866            self.app['datacenter'].storage, 'logs', 'datacenter.log')
     2867        logcontent = open(logfile).read()
     2868        self.assertTrue(
     2869            'zope.mgr - students.browser.CourseExportJobContainerJobConfig '
     2870            '- exported: students (2004, 100, COURSE1), job_id=%s'
     2871            % job_id in logcontent
     2872            )
     2873        self.assertTrue(
     2874            'zope.mgr - students.browser.ExportJobContainerDownload '
     2875            '- downloaded: WAeUP.Kofa_students_%s.csv, job_id=%s'
     2876            % (job_id, job_id) in logcontent
     2877            )
     2878        self.assertTrue(
     2879            'zope.mgr - students.browser.ExportJobContainerOverview '
     2880            '- discarded: job_id=%s' % job_id in logcontent
     2881            )
Note: See TracChangeset for help on using the changeset viewer.