Ignore:
Timestamp:
12 Jun 2016, 22:26:22 (9 years ago)
Author:
uli
Message:

Move lecturer CSV download test to new TestCase?.

Luckily we can shrink test size remarkably.

File:
1 edited

Legend:

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

    r13918 r13919  
    37813781            )
    37823782
    3783     def test_course_download_lecturer(self):
    3784         # We add study level 100 to the student's studycourse
    3785         studylevel = StudentStudyLevel()
    3786         studylevel.level = 100
    3787         studylevel.level_session = 2004
    3788         IWorkflowState(self.student).setState('courses validated')
    3789         self.student['studycourse'].addStudentStudyLevel(
    3790             self.certificate,studylevel)
    3791         course1_path = 'http://localhost/app/faculties/fac1/dep1/courses/COURSE1'
    3792         # Create lecturer
    3793         self.app['users'].addUser('mrlecturer', 'mrlecturersecret')
    3794         self.app['users']['mrlecturer'].email = 'mrlecturer@foo.ng'
    3795         self.app['users']['mrlecturer'].title = 'Carlo Intelligent'
    3796         prmglobal = IPrincipalRoleManager(self.course)
    3797         prmglobal.assignRoleToPrincipal('waeup.local.Lecturer', 'mrlecturer')
    3798         # Login as lecturer
    3799         self.browser.open(self.login_path)
    3800         self.browser.getControl(name="form.login").value = 'mrlecturer'
    3801         self.browser.getControl(name="form.password").value = 'mrlecturersecret'
    3802         self.browser.getControl("Login").click()
    3803         self.assertMatches('...You logged in...', self.browser.contents)
    3804         self.browser.open(course1_path)
    3805         self.assertFalse('Export' in self.browser.contents)
    3806         self.browser.getLink("Update scores").click()
    3807         self.assertTrue('Current academic session not set' in self.browser.contents)
    3808         self.app['configuration'].current_academic_session = 2004
    3809         self.browser.getLink("Update scores").click()
    3810         self.browser.getLink("Download editable tickets").click()
    3811         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    3812         self.assertEqual(self.browser.headers['Content-Type'],
    3813                          'text/csv; charset=UTF-8')
    3814         self.assertEqual(self.browser.contents, 'matric_number,student_id,'
    3815             'display_fullname,level,code,level_session,score\r\n234,'
    3816             'K1000000,Anna Tester,100,COURSE1,2004,\r\n')
    3817 
    38183783    def test_export_departmet_officers(self):
    38193784        # Create department officer
     
    40764041        open(path, 'wb').write(self.browser.contents)
    40774042        print "Sample PDF coursetickets.pdf written to %s" % path
     4043
     4044    def test_lecturers_can_download_scores_as_csv(self):
     4045        # Lecturers can download course scores as CSV.
     4046        self.login_as_lecturer()
     4047        self.browser.open(self.edit_scores_url)
     4048        self.browser.getLink("Download editable tickets").click()
     4049        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     4050        self.assertEqual(self.browser.headers['Content-Type'],
     4051                         'text/csv; charset=UTF-8')
     4052        self.assertEqual(self.browser.contents, 'matric_number,student_id,'
     4053            'display_fullname,level,code,level_session,score\r\n234,'
     4054            'K1000000,Anna Tester,100,COURSE1,2004,\r\n')
Note: See TracChangeset for help on using the changeset viewer.