Ignore:
Timestamp:
13 Jun 2016, 00:32:09 (8 years ago)
Author:
uli
Message:

Add test ensuring, score update via CSV works.

This is, where we want to go, not what already works.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/branches/uli-scores-upload/src/waeup/kofa/students/tests/test_browser.py

    r13919 r13921  
    40534053            'display_fullname,level,code,level_session,score\r\n234,'
    40544054            'K1000000,Anna Tester,100,COURSE1,2004,\r\n')
     4055
     4056    UPLOAD_CSV_TEMPLATE = (
     4057        'matric_number,student_id,display_fullname,level,code,'
     4058        'level_session,score\r\n'
     4059        'K1000000,Anna Tester,100,COURSE1,2004,%s\r\n')
     4060
     4061    def test_scores_csv_upload_available(self):
     4062        # lecturers can upload a CSV file to set values.
     4063        self.login_as_lecturer()
     4064        # set value to change from
     4065        self.student['studycourse']['100']['COURSE1'].score = 55
     4066        self.browser.open(self.edit_scores_url)
     4067        upload_ctrl = self.browser.getControl(name='uploadfile:file')
     4068        upload_file = StringIO(self.UPLOAD_CSV_TEMPLATE % '65')
     4069        upload_ctrl.add_file(upload_file, 'text/csv', 'myscores.csv')
     4070        self.browser.getControl("Update scores").click()
     4071        self.assertEqual(
     4072            self.student['studycourse']['100']['COURSE1'].score, 65)
Note: See TracChangeset for help on using the changeset viewer.