Ignore:
Timestamp:
21 Sep 2013, 08:27:47 (11 years ago)
Author:
Henrik Bettermann
Message:

Disable score editing on department manage page.

Add tests.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
4 edited

Legend:

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

    r10632 r10634  
    30713071        self.current_academic_session = grok.getSite()[
    30723072            'configuration'].current_academic_session
     3073        if self.context.__parent__.__parent__.score_editing_disabled:
     3074            self.flash(_('Score editing disabled.'))
     3075            self.redirect(self.url(self.context))
     3076            return
    30733077        if not self.current_academic_session:
    30743078            self.flash(_('Current academic session not set.'))
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_student_statistics.py

    r10574 r10634  
    4949    def test_get_student_stats_session_multiple(self):
    5050        # we can get a table with several students
    51         self.create_cert('fac2', 'dept2', 'CERT2')
     51        self.create_cert(u'fac2', u'dept2', u'CERT2')
    5252        result1 = get_student_stats(2010, 'Undergraduate Full-Time')
    5353        result2 = get_student_stats(2009, 'Undergraduate Full-Time')
     
    6969
    7070    def test_create_pdf(self):
    71         self.create_cert('FAC2', 'dept2', 'CERT2')
     71        self.create_cert(u'FAC2', u'dept2', u'CERT2')
    7272        report = StudentStatisticsReport(2010, 'Undergraduate Full-Time')
    7373        result = report.create_pdf()
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r10598 r10634  
    16831683            self.student['studycourse']['100']['COURSE1'].course,
    16841684            self.course)
    1685         # Lecturer can neither access ths student ...
     1685        # Lecturer can neither access the student ...
    16861686        self.assertRaises(
    16871687            Unauthorized, self.browser.open, self.student_path)
    1688         # ... nor the respective course ticket since a
     1688        # ... nor the respective course ticket since
    16891689        # editing course tickets by lecturers is not feasible.
    1690         # Course results must be imported.
    16911690        self.assertTrue('COURSE1' in self.student['studycourse']['100'].keys())
    16921691        course_ticket_path = self.student_path + '/studycourse/100/COURSE1'
    16931692        self.assertRaises(
    16941693            Unauthorized, self.browser.open, course_ticket_path)
     1694        # Course results can be batch edited via the edit_courses view
     1695        self.app['faculties']['fac1']['dep1'].score_editing_disabled = True
     1696        self.browser.open("http://localhost/app/faculties/fac1/dep1/courses/COURSE1")
     1697        self.browser.getLink("Update scores").click()
     1698        self.assertTrue('Score editing disabled' in self.browser.contents)
     1699        self.app['faculties']['fac1']['dep1'].score_editing_disabled = False
     1700        self.browser.getLink("Update scores").click()
     1701        self.assertTrue('Current academic session not set' in self.browser.contents)
     1702        self.app['configuration'].current_academic_session = 2004
     1703        self.browser.getLink("Update scores").click()
     1704        self.assertFalse(
     1705            '<input type="text" name="scores" class="span1" />'
     1706            in self.browser.contents)
     1707        IWorkflowState(self.student).setState('courses validated')
     1708        # Student must be in state 'courses validated'
     1709        self.browser.open(
     1710            "http://localhost/app/faculties/fac1/dep1/courses/COURSE1/edit_scores")
     1711        self.assertTrue(
     1712            '<input type="text" name="scores" class="span1" />'
     1713            in self.browser.contents)
     1714        self.browser.getControl(name="scores", index=0).value = '55'
     1715        self.browser.getControl("Update scores").click()
     1716        # New score has been set
     1717        self.assertEqual(
     1718            self.student['studycourse']['100']['COURSE1'].score, 55)
     1719        # Score editing has been logged
     1720        logfile = os.path.join(
     1721            self.app['datacenter'].storage, 'logs', 'students.log')
     1722        logcontent = open(logfile).read()
     1723        self.assertTrue('mrslecturer - students.browser.EditScoresPage - '
     1724                        'K1000000 100/COURSE1 score updated (55)' in logcontent)
    16951725
    16961726    def test_change_current_mode(self):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_move.py

    r9341 r10634  
    3131            self.app['faculties']['fac1']['dep1'].certificates['CERT1'],
    3232            self.certificate)
    33         self.app['faculties']['fac1']['dep2'] = Department(code='dep2')
     33        self.app['faculties']['fac1']['dep2'] = Department(code=u'dep2')
    3434        self.certificate.moveCertificate('fac1', 'dep2')
    3535        self.assertEqual(
Note: See TracChangeset for help on using the changeset viewer.