Ignore:
Timestamp:
29 Jan 2013, 08:56:56 (12 years ago)
Author:
Henrik Bettermann
Message:

Do not change level if level exceeds the certificate's end_level.

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

Legend:

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

    r9895 r9922  
    3939from waeup.kofa.app import University
    4040from waeup.kofa.payments.interfaces import IPaymentWebservice
     41from waeup.kofa.students.interfaces import IStudentsUtils
    4142from waeup.kofa.students.student import Student
    4243from waeup.kofa.students.studylevel import StudentStudyLevel
     
    26612662            'Your personal data record is outdated.' in self.browser.contents)
    26622663
     2664    def test_setReturningData(self):
     2665        utils = getUtility(IStudentsUtils)
     2666        self.student['studycourse'].current_level = 600
     2667        utils.setReturningData(self.student)
     2668        # The new level exceeds the certificates end_level.
     2669        # In this case current_level remains unchanged and no error is raised.
     2670        self.assertEqual(self.student['studycourse'].current_level, 600)
     2671
    26632672class StudentRequestPWTests(StudentsFullSetup):
    26642673    # Tests for student registration
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r9917 r9922  
    2525from reportlab.lib.styles import getSampleStyleSheet
    2626from reportlab.platypus import Paragraph, Image, Table, Spacer
     27from zope.schema.interfaces import ConstraintNotSatisfied
    2728from zope.component import getUtility, createObject
    2829from zope.formlib.form import setUpEditWidgets
     
    326327        """
    327328        new_session, new_level = self.getReturningData(student)
    328         student['studycourse'].current_level = new_level
     329        try:
     330            student['studycourse'].current_level = new_level
     331        except ConstraintNotSatisfied:
     332            # Do not change level if level exceeds the
     333            # certificate's end_level.
     334            pass
    329335        student['studycourse'].current_session = new_session
    330336        verdict = student['studycourse'].current_verdict
Note: See TracChangeset for help on using the changeset viewer.