Ignore:
Timestamp:
26 Feb 2015, 07:35:00 (10 years ago)
Author:
Henrik Bettermann
Message:

Add components to configure a student export jobs in faculties.

File:
1 edited

Legend:

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

    r12518 r12632  
    32993299        self.assertTrue(
    33003300            'zope.mgr - students.browser.DatacenterExportJobContainerJobConfig '
    3301             '- exported: bursary (2004, 100, ug_ft, None, None, '
     3301            '- exported: bursary (2004, 100, ug_ft, None, None, None, '
    33023302            '13/12/2012, 14/12/2012), job_id=%s'
    33033303            % job_id in logcontent
     
    33893389        self.assertTrue(
    33903390            'zope.mgr - students.browser.FacultiesExportJobContainerJobConfig '
    3391             '- exported: bursary (2004, 100, ug_ft, None, None, '
     3391            '- exported: bursary (2004, 100, ug_ft, None, None, None, '
    33923392            '13/12/2012, 14/12/2012), job_id=%s'
    33933393            % job_id in logcontent
     
    33963396            'zope.mgr - students.browser.ExportJobContainerDownload '
    33973397            '- downloaded: WAeUP.Kofa_bursary_%s.csv, job_id=%s'
     3398            % (job_id, job_id) in logcontent
     3399            )
     3400        self.assertTrue(
     3401            'zope.mgr - students.browser.ExportJobContainerOverview '
     3402            '- discarded: job_id=%s' % job_id in logcontent
     3403            )
     3404
     3405    def test_faculty_export(self):
     3406        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     3407        fac1_path = 'http://localhost/app/faculties/fac1'
     3408        self.browser.open(fac1_path)
     3409        self.browser.getLink("Export student data").click()
     3410        self.browser.getControl("Configure new export").click()
     3411        self.browser.getControl(name="exporter").value = ['students']
     3412        self.browser.getControl(name="session").value = ['2004']
     3413        self.browser.getControl(name="level").value = ['100']
     3414        self.browser.getControl(name="mode").value = ['ug_ft']
     3415        # The testbrowser does not hide the payment period fields, but
     3416        # values are ignored when using the students exporter.
     3417        self.browser.getControl(name="payments_start").value = '13/12/2012'
     3418        self.browser.getControl(name="payments_end").value = '14/12/2012'
     3419        self.browser.getControl("Create CSV file").click()
     3420
     3421        # When the job is finished and we reload the page...
     3422        job_id = self.wait_for_export_job_completed()
     3423        self.browser.open(fac1_path + '/exports')
     3424        # ... the csv file can be downloaded ...
     3425        self.browser.getLink("Download").click()
     3426        self.assertEqual(self.browser.headers['content-type'],
     3427            'text/csv; charset=UTF-8')
     3428        self.assertTrue(
     3429            'filename="WAeUP.Kofa_students_%s.csv' % job_id in
     3430            self.browser.headers['content-disposition'])
     3431        self.assertTrue(
     3432            'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,'
     3433            'firstname,lastname,matric_number,middlename,nationality,'
     3434            'officer_comment,perm_address,personal_updated,phone,reg_number,'
     3435            'sex,student_id,suspended,suspended_comment,transcript_comment,'
     3436            'password,state,history,certcode,is_postgrad,current_level,'
     3437            'current_session\r\n'
     3438            ',1,,1981-02-04#,aa@aa.ng,,Anna,Tester,234,,,,,,'
     3439            '1234#,123,m,K1000000,0,,,{SSHA}' in self.browser.contents)
     3440        self.assertEqual(len(self.app['datacenter'].running_exports), 1)
     3441        job_id = self.app['datacenter'].running_exports[0][0]
     3442        # ... and discarded
     3443        self.browser.open(fac1_path + '/exports')
     3444        self.browser.getControl("Discard").click()
     3445        self.assertEqual(len(self.app['datacenter'].running_exports), 0)
     3446        # Creation, downloading and discarding is logged
     3447        logfile = os.path.join(
     3448            self.app['datacenter'].storage, 'logs', 'datacenter.log')
     3449        logcontent = open(logfile).read()
     3450        self.assertTrue(
     3451            'zope.mgr - students.browser.FacultyExportJobContainerJobConfig '
     3452            '- exported: students (2004, 100, ug_ft, fac1, None, None, '
     3453            '13/12/2012, 14/12/2012), job_id=%s'
     3454            % job_id in logcontent
     3455            )
     3456        self.assertTrue(
     3457            'zope.mgr - students.browser.ExportJobContainerDownload '
     3458            '- downloaded: WAeUP.Kofa_students_%s.csv, job_id=%s'
    33983459            % (job_id, job_id) in logcontent
    33993460            )
     
    34413502        self.assertTrue(
    34423503            'zope.mgr - students.browser.DepartmentExportJobContainerJobConfig '
    3443             '- exported: students (2004, 100, ug_ft, dep1, None, '
     3504            '- exported: students (2004, 100, ug_ft, None, dep1, None, '
    34443505            '13/12/2012, 14/12/2012), job_id=%s'
    34453506            % job_id in logcontent
     
    34883549        self.assertTrue(
    34893550            'zope.mgr - students.browser.CertificateExportJobContainerJobConfig '
    3490             '- exported: students (2004, 100, None, None, CERT1, None, None), '
     3551            '- exported: students (2004, 100, None, None, None, CERT1, None, None), '
    34913552            'job_id=%s'
    34923553            % job_id in logcontent
Note: See TracChangeset for help on using the changeset viewer.