Ignore:
Timestamp:
10 Feb 2012, 20:05:55 (13 years ago)
Author:
Henrik Bettermann
Message:

It's quite tedious to setup the correct StudyLevelSource?. Now we have 2 probation levels and 3 spill-over levels. Pre-studies level (=10) can't be repeated.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_vocabularies.py

    r7616 r7625  
    3636        values = studylevelsource.getValues(studycourse)
    3737        self.assertEqual(values, [100, 110, 120, 200, 210, 220, 300, 310, 320,
    38             400, 410, 420, 500, 510, 520, 600, 610])
    39         self.assertTrue(studylevelsource.getTitle(studycourse, 0),
     38            400, 410, 420, 500, 510, 520, 600, 610, 620])
     39        self.assertEqual(studylevelsource.getTitle(studycourse, None),
     40            'Error: level id None out of range')
     41        self.assertEqual(studylevelsource.getTitle(studycourse, 0),
    4042            'Error: level id 0 out of range')
    41         self.assertTrue(studylevelsource.getTitle(studycourse, 10),
     43        self.assertEqual(studylevelsource.getTitle(studycourse, 10),
    4244            'Error: level id 10 out of range')
    43         self.assertTrue(studylevelsource.getTitle(studycourse, 100),
     45        self.assertEqual(studylevelsource.getTitle(studycourse, 100),
    4446            '100 (Year 1)')
    45         self.assertTrue(studylevelsource.getTitle(studycourse, 110),
    46             '100 (Year 1) on 1. probation')
    47         self.assertTrue(studylevelsource.getTitle(studycourse, 120),
    48             '100 (Year 1) on 2. probation')
    49         self.assertTrue(studylevelsource.getTitle(studycourse, 500),
     47        self.assertEqual(studylevelsource.getTitle(studycourse, 110),
     48            '100 (Year 1) on 1st probation')
     49        self.assertEqual(studylevelsource.getTitle(studycourse, 120),
     50            '100 (Year 1) on 2nd probation')
     51        self.assertEqual(studylevelsource.getTitle(studycourse, 500),
    5052            '500 (Year 5)')
    51         self.assertTrue(studylevelsource.getTitle(studycourse, 600),
    52             '500 (Year 5) spillover')
    53         self.assertTrue(studylevelsource.getTitle(studycourse, 610),
     53        self.assertEqual(studylevelsource.getTitle(studycourse, 600),
     54            '500 (Year 5) 1st spillover')
     55        self.assertEqual(studylevelsource.getTitle(studycourse, 610),
    5456            '500 (Year 5) 2nd spillover')
    55         self.assertTrue(studylevelsource.getTitle(studycourse, 620),
    56             'Error: level id 620 out of range')
    57         self.assertTrue(studylevelsource.getTitle(studycourse, 900),
    58             'Error: level id 900 out of range')
    59         # Now we change the certificates start_level in order to include
    60         # pre-studies
     57        self.assertEqual(studylevelsource.getTitle(studycourse, 620),
     58            '500 (Year 5) 3rd spillover')
     59        self.assertEqual(studylevelsource.getTitle(studycourse, 630),
     60            'Error: level id 630 out of range')
     61        self.assertEqual(studylevelsource.getTitle(studycourse, 700),
     62            'Error: level id 700 out of range')
     63        # Now we change the certificates start_level to pre-studies
    6164        studycourse.certificate.start_level = 10
    62         self.assertTrue(studylevelsource.getTitle(studycourse, 10),
     65        self.assertEqual(studylevelsource.getTitle(studycourse, 10),
    6366            'Pre-Studies')
     67        # Repeating Pre-Studies level does not exist
     68        self.assertRaises(KeyError,studylevelsource.getTitle,studycourse,20)
Note: See TracChangeset for help on using the changeset viewer.