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

Use keywords not only to filter students but also to restrict access to coursetickets which belong to the course so that lecturers (who gain access to courses) can download only coursetickets of their own course.

File:
1 edited

Legend:

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

    r9843 r9844  
    28352835            )
    28362836
    2837     def test_course_export(self):
     2837    def test_course_export_students(self):
    28382838        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    28392839        course1_path = 'http://localhost/app/faculties/fac1/dep1/courses/COURSE1'
     
    28802880            '- discarded: job_id=%s' % job_id in logcontent
    28812881            )
     2882
     2883    def test_course_export_coursetickets(self):
     2884        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     2885        course1_path = 'http://localhost/app/faculties/fac1/dep1/courses/COURSE1'
     2886        self.browser.open(course1_path)
     2887        self.browser.getLink("Export student data").click()
     2888        self.browser.getControl("Configure new export").click()
     2889        self.browser.getControl(name="exporter").value = ['coursetickets']
     2890        self.browser.getControl(name="session").value = ['2004']
     2891        self.browser.getControl(name="level").value = ['100']
     2892        self.browser.getControl("Create CSV file").click()
     2893
     2894        # When the job is finished and we reload the page...
     2895        job_id = self.wait_for_export_job_completed()
     2896        self.browser.open(course1_path + '/exports')
     2897        # ... the csv file can be downloaded ...
     2898        self.browser.getLink("Download").click()
     2899        self.assertEqual(self.browser.headers['content-type'],
     2900            'text/csv; charset=UTF-8')
     2901        self.assertTrue(
     2902            'filename="WAeUP.Kofa_coursetickets_%s.csv' % job_id in
     2903            self.browser.headers['content-disposition'])
     2904        self.assertEqual(len(self.app['datacenter'].running_exports), 1)
     2905        job_id = self.app['datacenter'].running_exports[0][0]
     2906        # ... and discarded
     2907        self.browser.open(course1_path + '/exports')
     2908        self.browser.getControl("Discard").click()
     2909        self.assertEqual(len(self.app['datacenter'].running_exports), 0)
     2910        # Creation, downloading and discarding is logged
     2911        logfile = os.path.join(
     2912            self.app['datacenter'].storage, 'logs', 'datacenter.log')
     2913        logcontent = open(logfile).read()
     2914        self.assertTrue(
     2915            'zope.mgr - students.browser.CourseExportJobContainerJobConfig '
     2916            '- exported: coursetickets (2004, 100, COURSE1), job_id=%s'
     2917            % job_id in logcontent
     2918            )
     2919        self.assertTrue(
     2920            'zope.mgr - students.browser.ExportJobContainerDownload '
     2921            '- downloaded: WAeUP.Kofa_coursetickets_%s.csv, job_id=%s'
     2922            % (job_id, job_id) in logcontent
     2923            )
     2924        self.assertTrue(
     2925            'zope.mgr - students.browser.ExportJobContainerOverview '
     2926            '- discarded: job_id=%s' % job_id in logcontent
     2927            )
Note: See TracChangeset for help on using the changeset viewer.