Ignore:
Timestamp:
28 Nov 2012, 07:52:56 (12 years ago)
Author:
Henrik Bettermann
Message:

Current level must be in range of certificate. This must be checked in checkUpdateRequirements.

File:
1 edited

Legend:

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

    r9706 r9735  
    575575
    576576    def test_checkUpdateRequirements(self):
    577         # Make sure that pg students can't be updated with wrong transition.
     577        # Current level must be in range of certificate.
     578        # Since row has passed the converter, current_level is an integer.
    578579        err = self.processor.checkUpdateRequirements(
    579580            self.student['studycourse'],
    580             dict(reg_number='1', current_level='100'), self.app)
     581            dict(reg_number='1', current_level=100), self.app)
     582        self.assertEqual(err, 'current_level not in range.')
     583        err = self.processor.checkUpdateRequirements(
     584            self.student['studycourse'],
     585            dict(reg_number='1', current_level=200), self.app)
    581586        self.assertTrue(err is None)
    582         # Since row has passed the converter, current_level is an integer.
     587        # We can update pg students.
     588        self.student['studycourse'].certificate.start_level=999
     589        self.student['studycourse'].certificate.end_level=999
    583590        err = self.processor.checkUpdateRequirements(
    584591            self.student['studycourse'],
    585592            dict(reg_number='1', current_level=999), self.app)
    586593        self.assertTrue(err is None)
     594        # Make sure that pg students can't be updated with wrong transition.
    587595        IWorkflowState(self.student).setState('returning')
    588596        err = self.processor.checkUpdateRequirements(
     
    590598            dict(reg_number='1', current_level=999), self.app)
    591599        self.assertEqual(err, 'Not a pg student.')
     600        # If certificate is not given in row (and has thus
     601        # successfully passed checkConversion) the certificate
     602        # attribute must be set.
     603        self.student['studycourse'].certificate = None
     604        err = self.processor.checkUpdateRequirements(
     605            self.student['studycourse'],
     606            dict(reg_number='1', current_level=100), self.app)
     607        self.assertEqual(err, 'No certificate to check level.')
    592608
    593609    def test_import(self):
Note: See TracChangeset for help on using the changeset viewer.