Ignore:
Timestamp:
10 Oct 2012, 20:44:33 (12 years ago)
Author:
Henrik Bettermann
Message:

Test if all titles for the various start_level and end_level combinations do exist.

File:
1 edited

Legend:

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

    r9135 r9325  
    3737        self.assertEqual(values, [100, 110, 120, 200, 210, 220, 300, 310, 320,
    3838            400, 410, 420, 500, 510, 520, 600, 610, 620])
     39        # All titles do exist
     40        titles = [studylevelsource.getTitle(studycourse, value)
     41            for value in values]
     42        self.assertEqual(len(titles), 18)
    3943        # Unfortunately, unittests don't know about internationalization
    4044        self.assertEqual(studylevelsource.getTitle(studycourse, None),
     
    6266        self.assertEqual(studylevelsource.getTitle(studycourse, 700),
    6367            'Error: level id ${value} out of range')
    64         # Now we change the certificates start_level to pre-studies
     68        # Now we modify the certificates to be a pure to pre-studies
     69        # course
    6570        studycourse.certificate.start_level = 10
     71        studycourse.certificate.end_level = 10
     72        values = studylevelsource.getValues(studycourse)
     73        self.assertEqual(values, [10])
     74        titles = [studylevelsource.getTitle(studycourse, value)
     75            for value in values]
     76        self.assertEqual(len(titles), 1)
    6677        self.assertEqual(studylevelsource.getTitle(studycourse, 10),
    6778            'Pre-Studies')
    68         # Repeating Pre-Studies level does not exist
     79        # Finally we modify the certificate to be a mixed course,
     80        # starting with pre-studies.
     81        studycourse.certificate.end_level = 200
     82        values = studylevelsource.getValues(studycourse)
     83        self.assertEqual(values, [10, 100, 110, 120,
     84            200, 210, 220, 300, 310, 320])
     85        titles = [studylevelsource.getTitle(studycourse, value)
     86            for value in values]
     87        self.assertEqual(len(titles), 10)
     88        # Repeating Pre-Studies level does not exist and raises a KeyError
     89        # when trying to get its title
    6990        self.assertRaises(KeyError,studylevelsource.getTitle,studycourse,20)
Note: See TracChangeset for help on using the changeset viewer.