Ignore:
Timestamp:
7 Mar 2017, 06:51:42 (8 years ago)
Author:
Henrik Bettermann
Message:

Transform helper functions into class methods to ease customization.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests
Files:
3 edited

Legend:

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

    r14529 r14605  
    55from waeup.kofa.interfaces import IJobManager
    66from waeup.kofa.students.reports.level_report import (
    7     get_students, LevelReport, ILevelReport)
     7    LevelReport, ILevelReport)
    88from waeup.kofa.students.tests.test_catalog import CatalogTestSetup
    99from waeup.kofa.students.tests.test_browser import StudentsFullSetup
     
    6565        self._add_tickets()
    6666         # we can get a table with one student
    67         result = get_students('fac1', 'dep1', 'CERT1', 2010, 100)
     67        lr =  LevelReport('fac1', 'dep1', 'CERT1', 2010, 100)
     68        result = lr._get_students('fac1', 'dep1', 'CERT1', 2010, 100)
    6869        self.assertEqual(result,
    6970            [(u'1234', u'Bob Tester', 90, 30, '1.666',
     
    7172            90, 30, '1.666', '')])
    7273        # same result when selecting all certificates
    73         result = get_students('fac1', 'dep1', 'all', 2010, 100)
     74        result = lr._get_students('fac1', 'dep1', 'all', 2010, 100)
    7475        self.assertEqual(result,
    7576            [(u'1234', u'Bob Tester', 90, 30, '1.666',
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_raw_score_report.py

    r14505 r14605  
    1010from waeup.kofa.browser.tests.test_pdf import samples_dir
    1111from waeup.kofa.students.reports.raw_score_report import (
    12     get_students, RawScoreReport, IRawScoreReport,
    13     get_courses)
     12    RawScoreReport, IRawScoreReport)
    1413
    1514
     
    3736    def test_get_courses(self):
    3837        # we can get a list with one course code
    39         result = get_courses('fac1', 'dep1', 'CERT1', 2010, 100)
     38        rsr = RawScoreReport('fac1', 'dep1', 'CERT1', 2010, 100)
     39        result = rsr._get_courses('fac1', 'dep1', 'CERT1', 2010, 100)
    4040        self.assertEqual(result, [(u'Course1')])
    4141        return
     
    4343    def test_get_students(self):
    4444        # we can get a table with one student
    45         course_codes = get_courses('fac1', 'dep1', 'CERT1', 2010, 100)
    46         result = get_students('fac1', 'dep1', 'CERT1', 2010, 100, course_codes)
     45        rsr = RawScoreReport('fac1', 'dep1', 'CERT1', 2010, 100)
     46        course_codes = rsr._get_courses('fac1', 'dep1', 'CERT1', 2010, 100)
     47        result = rsr._get_students(
     48            'fac1', 'dep1', 'CERT1', 2010, 100, course_codes)
    4749        self.assertEqual(result,
    4850            [(u'1234', u'Bob Tester', {'Course1': (70, 'A')})])
    4951        self.student['studycourse']['100']['Course1'].score = None
    50         result = get_students('fac1', 'dep1', 'CERT1', 2010, 100, course_codes)
     52        result = rsr._get_students(
     53            'fac1', 'dep1', 'CERT1', 2010, 100, course_codes)
    5154        self.assertEqual(result,
    5255            [(u'1234', u'Bob Tester', {'Course1': ('Nil', '')})])
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_session_results_presentation.py

    r14514 r14605  
    66from waeup.kofa.interfaces import IJobManager
    77from waeup.kofa.students.reports.session_results_presentation import (
    8     get_students, SessionResultsPresentation, ISessionResultsPresentation)
     8    SessionResultsPresentation, ISessionResultsPresentation)
    99from waeup.kofa.students.tests.test_catalog import CatalogTestSetup
    1010from waeup.kofa.students.tests.test_browser import StudentsFullSetup
     
    2626
    2727    def test_get_students(self):
    28         result = get_students('fac1', 'dep1', 'CERT1', 2010, 100)
     28        sr = SessionResultsPresentation('fac1', 'dep1', 'CERT1', 2010, 100)
     29        result = sr._get_students('fac1', 'dep1', 'CERT1', 2010, 100)
    2930        self.assertEqual(result,
    3031            [[], [], [], [], [], [(u'K1000000', u'1234', u'Bob Tester')], []])
     
    3233
    3334    def test_get_students_at_all_levels(self):
    34         result = get_students('fac1', 'dep1', 'CERT1', 2010, 0)
     35        sr = SessionResultsPresentation('fac1', 'dep1', 'CERT1', 2010, 100)
     36        result = sr._get_students('fac1', 'dep1', 'CERT1', 2010, 0)
    3537        self.assertEqual(result,
    3638            [[], [], [], [], [], [(u'K1000000', u'1234', u'Bob Tester')], []])
     
    3840
    3941    def test_get_students_all_certs(self):
    40         result = get_students('fac1', 'dep1', 'all', 2010, 100)
     42        sr = SessionResultsPresentation('fac1', 'dep1', 'all', 2010, 100)
     43        result = sr._get_students('fac1', 'dep1', 'all', 2010, 100)
    4144        self.assertEqual(result,
    4245            [[], [], [], [], [], [(u'K1000000', u'1234', u'Bob Tester')], []])
     
    4952        studylevel.level_session = 2010
    5053        self.student['studycourse']['200'] = studylevel
    51         result = get_students('fac1', 'dep1', 'CERT1', 2010, 0)
     54        sr = SessionResultsPresentation('fac1', 'dep1', 'CERT1', 2010, 100)
     55        result = sr._get_students('fac1', 'dep1', 'CERT1', 2010, 0)
    5256        self.assertEqual(result,
    5357            [[], [], [], [], [], [], [(u'K1000000', u'1234', u'Bob Tester')]])
     
    5660    def test_get_students_without_scores(self):
    5761        self.student['studycourse']['100']['Course1'].score = None
    58         result = get_students('fac1', 'dep1', 'CERT1', 2010, 0)
     62        sr = SessionResultsPresentation('fac1', 'dep1', 'CERT1', 2010, 100)
     63        result = sr._get_students('fac1', 'dep1', 'CERT1', 2010, 0)
    5964        self.assertEqual(result,
    6065            [[], [], [], [], [], [], [(u'K1000000', u'1234', u'Bob Tester')]])
     
    6267    def test_get_students_without_level_in_session(self):
    6368        self.student['studycourse']['100'].level_session = 2011
    64         result = get_students('fac1', 'dep1', 'CERT1', 2010)
     69        sr = SessionResultsPresentation('fac1', 'dep1', 'CERT1', 2010, 100)
     70        result = sr._get_students('fac1', 'dep1', 'CERT1', 2010)
    6571        self.assertEqual(result,
    6672            [[], [], [], [], [], [], []])
Note: See TracChangeset for help on using the changeset viewer.