- Timestamp:
- 5 May 2015, 12:17:58 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students/tests/test_utils.py
r9614 r12904 1 1 # -*- coding: utf-8 -*- 2 from hurry.workflow.interfaces import IWorkflowState 3 from zope.component import getUtility 2 4 from waeup.kofa.testing import FunctionalTestCase 3 from zope.component import getUtility 5 from waeup.kofa.university.faculty import Faculty 6 from waeup.kofa.university.department import Department 4 7 from waeup.kofa.students.interfaces import IStudentsUtils 5 8 from waeup.kofa.students.tests.test_browser import StudentsFullSetup 6 9 from waeup.kwarapoly.testing import FunctionalLayer 7 10 8 class BedAllocationTests(StudentsFullSetup):11 class StudentsUtilsTests(StudentsFullSetup): 9 12 10 13 layer = FunctionalLayer … … 43 46 self.assertEqual(acc_details['bt'], 'regular_male_fi') 44 47 return 48 49 def test_setMatricNumber(self): 50 utils = getUtility(IStudentsUtils) 51 self.student.matric_number = None 52 msg, mnumber = utils.setMatricNumber(self.student) 53 self.assertEqual(msg, 'Matriculation number cannot be set.') 54 self.assertEqual(mnumber, None) 55 self.student['studycourse'].entry_mode = 'nd_ft' 56 self.student['studycourse'].entry_session = 2013 57 msg, mnumber = utils.setMatricNumber(self.student) 58 self.assertEqual(self.student.matric_number, 'ND/13/dep1/FT/001') 59 self.assertEqual( 60 self.app['faculties']['fac1']['dep1'].next_matric_dict, 61 {2013: 2}) 62 # setting a new matric number in 2014, extends next_matric_dict 63 self.student['studycourse'].entry_session = 2014 64 self.student.matric_number = None 65 msg, mnumber = utils.setMatricNumber(self.student) 66 self.assertEqual( 67 self.app['faculties']['fac1']['dep1'].next_matric_dict, 68 {2013: 2, 2014: 2}) 69 # setting a new matric number in 2014 again, increases the counter 70 self.student.matric_number = None 71 msg, mnumber = utils.setMatricNumber(self.student) 72 self.assertEqual( 73 self.app['faculties']['fac1']['dep1'].next_matric_dict, 74 {2013: 2, 2014: 3}) 75 # matric number must not exist 76 msg, mnumber = utils.setMatricNumber(self.student) 77 self.assertEqual(msg, 'Matriculation number already set.') 78 # certificate must be set. 79 self.student.matric_number = None 80 self.student['studycourse'].certificate = None 81 msg, mnumber = utils.setMatricNumber(self.student) 82 self.assertEqual(msg, 'No certificate assigned.') 83 return
Note: See TracChangeset for help on using the changeset viewer.