Ignore:
Timestamp:
22 Apr 2014, 20:52:00 (11 years ago)
Author:
Henrik Bettermann
Message:

AAUE matric number construction scheme applied by customization of _constructMatricNumber.

Two more study modes added.

File:
1 edited

Legend:

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

    r11004 r11593  
    1919import shutil
    2020import tempfile
     21import grok
    2122from StringIO import StringIO
    2223from hurry.workflow.interfaces import IWorkflowState
     
    433434        self.assertEqual(utils.maxCredits(dummy), 48)
    434435        return
     436
     437    def test_set_matric_number(self):
     438        site = grok.getSite()
     439        utils = getUtility(IStudentsUtils)
     440        site['configuration'].next_matric_integer = 1
     441        self.student.matric_number = None
     442        msg, mnumber = utils.setMatricNumber(self.student)
     443        self.assertEqual(msg, None)
     444        self.assertEqual(mnumber, 1)
     445        self.assertEqual(self.student.matric_number, 'fac1/dep1/04/00001')
     446        self.assertEqual(site['configuration'].next_matric_integer, 2)
     447        # Part time have an extended matric number
     448        self.student.matric_number = None
     449        self.student['studycourse'].certificate.study_mode = 'ug_pt'
     450        msg, mnumber = utils.setMatricNumber(self.student)
     451        self.assertEqual(self.student.matric_number, 'PTP/fac1/dep1/04/00002')
     452        # Foundation programme students don't get matric number.
     453        self.student.matric_number = None
     454        self.student['studycourse'].certificate.study_mode = 'found'
     455        msg, mnumber = utils.setMatricNumber(self.student)
     456        self.assertEqual(msg, 'Matriculation number cannot be set.')
     457        self.assertEqual(mnumber, None)
     458        # Certificate must be set.
     459        self.student.matric_number = None
     460        self.student['studycourse'].certificate = None
     461        msg, mnumber = utils.setMatricNumber(self.student)
     462        self.assertEqual(msg, 'No certificate assigned.')
     463        return
Note: See TracChangeset for help on using the changeset viewer.