Ignore:
Timestamp:
2 Dec 2014, 06:36:49 (10 years ago)
Author:
Henrik Bettermann
Message:

Add test for ClearanceRequestedStudentExporter?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_export.py

    r12107 r12108  
    22from zope.component import queryUtility
    33from zope.interface.verify import verifyObject, verifyClass
     4from hurry.workflow.interfaces import IWorkflowState
    45from waeup.kofa.interfaces import ICSVExporter
    56from waeup.kofa.schoolgrades import ResultEntry
     
    89from kofacustom.nigeria.utils.utils import NigeriaKofaUtils
    910from kofacustom.nigeria.students.export import (
    10     NigeriaStudentExporter, NigeriaStudentPaymentsExporter)
     11    NigeriaStudentExporter, NigeriaStudentPaymentsExporter,
     12    ClearanceRequestedStudentExporter)
    1113from kofacustom.nigeria.testing import FunctionalLayer
    1214
     
    111113            )
    112114        return
     115
     116class ClearanceRequestedStudentExporterTest(StudentImportExportSetup):
     117
     118    layer = FunctionalLayer
     119
     120    def setUp(self):
     121        super(ClearanceRequestedStudentExporterTest, self).setUp()
     122        self.setup_for_export()
     123        return
     124
     125    def test_ifaces(self):
     126        # make sure we fullfill interface contracts
     127        obj = ClearanceRequestedStudentExporter()
     128        verifyObject(ICSVExporter, obj)
     129        verifyClass(ICSVExporter, ClearanceRequestedStudentExporter)
     130        return
     131
     132    def test_export_all(self):
     133        # we can really export students
     134        # set values we can expect in export file
     135        self.setup_student(self.student)
     136        self.student.date_of_invitation = 'Come soon'
     137        IWorkflowState(self.student).setState('clearance requested')
     138        exporter = ClearanceRequestedStudentExporter()
     139        exporter.export_all(self.app, self.outfile)
     140        result = open(self.outfile, 'rb').read()
     141        self.assertMatches(
     142            'student_id,reg_number,display_fullname,state,current_session,'
     143            'history,date_of_invitation\r\n'
     144            'A111111,123,Anna M. Tester,clearance requested,'
     145            '2012,2014-12-02 07:17:02 WAT - Record created by system,'
     146            'Come soon\r\n',
     147            result
     148            )
     149        return
Note: See TracChangeset for help on using the changeset viewer.