Changeset 9735 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 28 Nov 2012, 07:52:56 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py
r9706 r9735 455 455 """ 456 456 current_level = row.get('current_level', None) 457 if current_level == 999 and \ 458 obj.__parent__.state in FORBIDDEN_POSTGRAD_STATES: 459 return 'Not a pg student.' 457 if current_level: 458 if current_level == 999 and \ 459 obj.__parent__.state in FORBIDDEN_POSTGRAD_STATES: 460 return 'Not a pg student.' 461 certificate = getattr(obj, 'certificate', None) 462 cert = row.get('certificate', None) 463 if certificate is None and cert is None: 464 return 'No certificate to check level.' 465 if certificate is not None and ( 466 current_level < certificate.start_level or \ 467 current_level > certificate.end_level+120): 468 return 'current_level not in range.' 460 469 return None 461 470 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py
r9706 r9735 575 575 576 576 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. 578 579 err = self.processor.checkUpdateRequirements( 579 580 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) 581 586 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 583 590 err = self.processor.checkUpdateRequirements( 584 591 self.student['studycourse'], 585 592 dict(reg_number='1', current_level=999), self.app) 586 593 self.assertTrue(err is None) 594 # Make sure that pg students can't be updated with wrong transition. 587 595 IWorkflowState(self.student).setState('returning') 588 596 err = self.processor.checkUpdateRequirements( … … 590 598 dict(reg_number='1', current_level=999), self.app) 591 599 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.') 592 608 593 609 def test_import(self):
Note: See TracChangeset for help on using the changeset viewer.