Ignore:
Timestamp:
4 May 2012, 11:49:25 (13 years ago)
Author:
uli
Message:

Extend import-export-setup to avoid repetition.

File:
1 edited

Legend:

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

    r8309 r8340  
    3636    StudentOnlinePaymentProcessor, StudentVerdictProcessor)
    3737from waeup.kofa.students.student import Student
     38from waeup.kofa.students.studylevel import StudentStudyLevel, CourseTicket
    3839from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase
    3940from waeup.kofa.interfaces import IBatchProcessor, FatalCSVError
     
    155156        clearSite()
    156157        return
     158
     159    def setup_for_export(self):
     160        student = Student()
     161        student.student_id = u'A111111'
     162        self.app['students'][student.student_id] = self.student = student
     163        self.outfile = os.path.join(self.workdir, 'myoutput.csv')
     164        return
     165
     166    def setup_student(self, student):
     167        # set predictable values for `student`
     168        student.matric_number = u'M123456'
     169        student.adm_code = u'my adm code'
     170        student.clearance_locked = False
     171        student.clr_code = u'my clr code'
     172        student.perm_address = u'Studentroad 21\nLagos 123456\n'
     173        student.reg_number = u'123456'
     174        student.student_id = u'A111111'
     175        student.firstname = u'Anna'
     176        student.lastname = u'Tester'
     177        student.middlename = u'M.'
     178        student.date_of_birth = datetime.date(1981, 2, 4)
     179        student.sex = 'f'
     180        student.email = 'anna@sample.com'
     181        student.phone = u'+234-123-12345'
     182        student.notice = u'Some notice\nin lines.'
     183        student.nationality = u'NG'
     184
     185        student['studycourse'].certificate = self.certificate
     186        student['studycourse'].entry_mode = 'ug_ft'
     187        student['studycourse'].entry_session = 2010
     188        student['studycourse'].current_session = 2012
     189        student['studycourse'].current_level = int(self.certificate.start_level)
     190
     191        study_level = StudentStudyLevel()
     192        study_level.level_session = 2012
     193        study_level.level_verdict = "A"
     194        study_level.level = 100
     195        student['studycourse'].addStudentStudyLevel(
     196            self.certificate, study_level)
     197
     198        ticket = CourseTicket()
     199        ticket.automatic = True
     200        ticket.carry_over = True
     201        ticket.code = u'CRS1'
     202        ticket.title = u'Course 1'
     203        ticket.fcode = u'FAC1'
     204        ticket.dcode = u'DEP1'
     205        ticket.credits = 100
     206        ticket.passmark = 100
     207        ticket.semester = 2
     208        study_level.addCourseTicket(ticket)
     209
     210        return student
    157211
    158212
Note: See TracChangeset for help on using the changeset viewer.