Ignore:
Timestamp:
5 Apr 2018, 15:30:08 (7 years ago)
Author:
Henrik Bettermann
Message:

Add ticket level and session filter to CourseTicketExporter.

File:
1 edited

Legend:

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

    r14642 r14984  
    680680
    681681        exporter = CourseTicketExporter()
    682         exporter.export_filtered(
    683             self.student, self.outfile)
     682        exporter.export_filtered(self.student, self.outfile)
    684683        result = open(self.outfile, 'rb').read()
    685684        self.assertEqual(
     
    691690            'Anna M. Tester\r\n'
    692691            )
    693         # if the coursetickets catalog is used to filter students
     692        # We can set the course tickets level and level_session without code
     693        # (used in the datacenter)
     694        notify(grok.ObjectModifiedEvent(self.student['studycourse']['100']['CRS1']))
     695        exporter.export_filtered(self.student, self.outfile, ct_level='100',
     696            ct_session='2012')
     697        result = open(self.outfile, 'rb').read()
     698        self.assertEqual(
     699            result,
     700            'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,'
     701            'mandatory,outstanding,passmark,score,semester,title,student_id,certcode,'
     702            'display_fullname\r\n'
     703            '1,1,CRS1,,100,DEP1,FAC1,100,2012,0,0,100,,2,Course 1,A111111,CERT1,'
     704            'Anna M. Tester\r\n'
     705            )
     706        # 'all' does select all
     707        notify(grok.ObjectModifiedEvent(self.student['studycourse']['100']['CRS1']))
     708        exporter.export_filtered(self.student, self.outfile, ct_level='all',
     709            ct_session='2012')
     710        result = open(self.outfile, 'rb').read()
     711        self.assertEqual(
     712            result,
     713            'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,'
     714            'mandatory,outstanding,passmark,score,semester,title,student_id,certcode,'
     715            'display_fullname\r\n'
     716            '1,1,CRS1,,100,DEP1,FAC1,100,2012,0,0,100,,2,Course 1,A111111,CERT1,'
     717            'Anna M. Tester\r\n'
     718            )
     719        # Level 200 tickets do not exist.
     720        notify(grok.ObjectModifiedEvent(self.student['studycourse']['100']['CRS1']))
     721        exporter.export_filtered(self.student, self.outfile, ct_level='200')
     722        result = open(self.outfile, 'rb').read()
     723        self.assertEqual(
     724            result,
     725            'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,'
     726            'mandatory,outstanding,passmark,score,semester,title,student_id,certcode,'
     727            'display_fullname\r\n'
     728                        )
     729        # Session 2013 tickets do not exist.
     730        notify(grok.ObjectModifiedEvent(self.student['studycourse']['100']['CRS1']))
     731        exporter.export_filtered(self.student, self.outfile,
     732            ct_level='all', ct_session='2013')
     733        result = open(self.outfile, 'rb').read()
     734        self.assertEqual(
     735            result,
     736            'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,'
     737            'mandatory,outstanding,passmark,score,semester,title,student_id,certcode,'
     738            'display_fullname\r\n'
     739            )
     740        # If the coursetickets catalog is used to filter students
    694741        # and (course) code is not None
    695742        # only course tickets which belong to this course are exported
Note: See TracChangeset for help on using the changeset viewer.