Ignore:
Timestamp:
18 Nov 2016, 07:19:25 (8 years ago)
Author:
Henrik Bettermann
Message:

Lecturers can edit current session and previous session courses whenever they like. All restrictions are removed.

File:
1 edited

Legend:

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

    r14266 r14288  
    7979            'http://localhost/app/faculties/fac1/dep1/courses/COURSE1')
    8080        self.edit_scores_url = '%s/edit_scores' % self.course_url
     81        self.edit_prev_scores_url = '%s/edit_prev_scores' % self.course_url
    8182        # Set standard parameters
    8283        self.app['configuration'].current_academic_session = 2004
     
    363364        self.student['studycourse']['100']['COURSE1'].score = 55
    364365        self.browser.open(self.edit_scores_url)
     366        upload_ctrl = self.browser.getControl(name='uploadfile:file')
     367        upload_file = StringIO(UPLOAD_CSV_TEMPLATE % ('65','22'))
     368        upload_ctrl.add_file(upload_file, 'text/csv', 'myscores.csv')
     369        self.browser.getControl("Update editable scores from").click()
     370        # value changed
     371        self.assertEqual(
     372            self.student['studycourse']['100']['COURSE1'].score, 65)
     373        self.assertEqual(
     374            self.student['studycourse']['100']['COURSE1'].ca, 22)
     375
     376    def test_scores_previous_session(self):
     377        # lecturers can download a CSV file to set values.
     378        self.login_as_lecturer()
     379        self.student['studycourse']['100']['COURSE1'].score = 55
     380        self.browser.open(self.edit_prev_scores_url)
     381        self.assertTrue('No student found' in self.browser.contents)
     382        self.student['studycourse']['100'].level_session = 2003
     383        notify(grok.ObjectModifiedEvent(self.student['studycourse']['100']['COURSE1']))
     384        self.browser.open(self.edit_prev_scores_url)
     385        self.browser.getLink("Download csv file").click()
     386        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     387        self.assertEqual(self.browser.headers['Content-Type'],
     388                         'text/csv; charset=UTF-8')
     389        self.assertEqual(self.browser.contents, 'matric_number,student_id,'
     390            'level,code,level_session,ca,score\r\n234,E1000000,'
     391            '100,COURSE1,2003,,55\r\n')
     392        self.browser.open(self.edit_prev_scores_url)
    365393        upload_ctrl = self.browser.getControl(name='uploadfile:file')
    366394        upload_file = StringIO(UPLOAD_CSV_TEMPLATE % ('65','22'))
Note: See TracChangeset for help on using the changeset viewer.