Ignore:
Timestamp:
30 Nov 2012, 12:24:13 (12 years ago)
Author:
Henrik Bettermann
Message:

Add StudentStudyLevelsOverviewExporter?.

File:
1 edited

Legend:

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

    r9734 r9744  
    88    StudentsExporter, StudentStudyCourseExporter, StudentStudyLevelExporter,
    99    CourseTicketExporter, PaymentsExporter, BedTicketsExporter,
    10     StudentPaymentsOverviewExporter, get_students, StudentsExportFilter)
     10    StudentPaymentsOverviewExporter, StudentStudyLevelsOverviewExporter,
     11    get_students, StudentsExportFilter)
    1112from waeup.kofa.students.accommodation import BedTicket
    1213from waeup.kofa.students.interfaces import ICSVStudentExporter
     
    643644            )
    644645        return
     646
     647class StudentStudyLevelsOverviewExporterTest(StudentImportExportSetup):
     648
     649    layer = FunctionalLayer
     650
     651    def setUp(self):
     652        super(StudentStudyLevelsOverviewExporterTest, self).setUp()
     653        self.setup_for_export()
     654        return
     655
     656    def test_ifaces(self):
     657        obj = StudentStudyLevelsOverviewExporter()
     658        verifyObject(ICSVExporter, obj)
     659        verifyClass(ICSVExporter, StudentStudyLevelsOverviewExporter)
     660        return
     661
     662    def test_get_as_utility(self):
     663        result = queryUtility(ICSVExporter, name="studylevelsoverview")
     664        self.assertTrue(result is not None)
     665        return
     666
     667    def test_export(self):
     668        self.setup_student(self.student)
     669        exporter = StudentStudyLevelsOverviewExporter()
     670        exporter.export([self.student], self.outfile)
     671        result = open(self.outfile, 'rb').read()
     672        self.assertEqual(
     673             'student_id,state,certcode,faccode,depcode,is_postgrad,'
     674             'current_level,current_session,'
     675             '10,100,110,120,200,210,220,300,310,320,400,410,420,500,'
     676             '510,520,600,610,620,700,710,720,800,810,820,900,910,920,999\r\n'
     677             'A111111,created,CERT1,NA,NA,0,200,2012,,2012|1|None|A'
     678             ',,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n',
     679            result
     680            )
     681        return
     682
     683    def test_export_all(self):
     684        self.setup_student(self.student)
     685        exporter = StudentStudyLevelsOverviewExporter()
     686        exporter.export_all(self.app, self.outfile)
     687        result = open(self.outfile, 'rb').read()
     688        self.assertEqual(
     689            'student_id,state,certcode,faccode,depcode,is_postgrad,'
     690            'current_level,current_session,'
     691            '10,100,110,120,200,210,220,300,310,320,400,410,420,500,'
     692            '510,520,600,610,620,700,710,720,800,810,820,900,910,920,999\r\n'
     693            'A111111,created,CERT1,NA,NA,0,200,2012,,2012|1|None|A'
     694            ',,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n',
     695            result
     696            )
     697        return
Note: See TracChangeset for help on using the changeset viewer.