Changeset 8411 for main/waeup.kofa/trunk/src/waeup/kofa/students/tests
- Timestamp:
- 10 May 2012, 16:38:15 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students/tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py
r8354 r8411 34 34 StudentStudyLevelProcessor, CourseTicketProcessor, 35 35 StudentOnlinePaymentProcessor, StudentVerdictProcessor) 36 from waeup.kofa.students.payments import StudentOnlinePayment 36 37 from waeup.kofa.students.student import Student 37 38 from waeup.kofa.students.studylevel import StudentStudyLevel, CourseTicket … … 208 209 ticket.semester = 2 209 210 study_level.addCourseTicket(ticket) 210 211 self.add_payment(student) 211 212 return student 213 214 def add_payment(self, student): 215 # get a payment with all fields set 216 payment = StudentOnlinePayment() 217 payment.creation_date = datetime.datetime(2012, 4, 1, 13, 12, 1) 218 payment.p_id = 'my-id' 219 payment.ac = u'666' 220 payment.p_item = u'p-item' 221 payment.p_level = 100 222 payment.p_session = 2012 223 payment.payment_date = datetime.datetime(2012, 4, 1, 14, 12, 1) 224 payment.r_amount_approved = 12.12 225 payment.r_code = u'r-code' 226 # XXX: there is no addPayment method to give predictable names 227 student['payments']['my-payment'] = payment 228 return payment 229 212 230 213 231 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r8402 r8411 72 72 return 73 73 74 def test_export_student(self): 75 # we can export a single student 76 self.setup_student(self.student) 77 exporter = StudentsExporter() 78 exporter.export_student(self.student, self.outfile) 79 result = open(self.outfile, 'rb').read() 80 self.assertEqual( 81 result, 82 'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,' 83 'firstname,lastname,matric_number,middlename,nationality,' 84 'perm_address,phone,reg_number,sex,student_id\r\n' 85 86 'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,Anna,' 87 'Tester,M123456,M.,NG,"Studentroad 21\nLagos 123456\n",' 88 '+234-123-12345,123456,f,A111111\r\n' 89 ) 90 return 91 92 74 93 class StudentStudyCourseExporterTest(StudentImportExportSetup): 75 94 … … 142 161 return 143 162 163 def test_export_student(self): 164 # we can export studycourse of a certain student 165 self.setup_student(self.student) 166 exporter = StudentStudyCourseExporter() 167 exporter.export_student(self.student, self.outfile) 168 result = open(self.outfile, 'rb').read() 169 self.assertEqual( 170 result, 171 'certificate,current_level,current_session,current_verdict,' 172 'entry_mode,entry_session,previous_verdict\r\n' 173 174 'CERT1,200,2012,0,ug_ft,2010,0\r\n' 175 ) 176 return 177 144 178 class StudentStudyLevelExporterTest(StudentImportExportSetup): 145 179 … … 207 241 return 208 242 243 def test_export_student(self): 244 # we can really export study levels of a certain student 245 self.setup_student(self.student) 246 exporter = StudentStudyLevelExporter() 247 exporter.export_student(self.student, self.outfile) 248 result = open(self.outfile, 'rb').read() 249 self.assertEqual( 250 result, 251 'level,level_session,level_verdict,matric_number,reg_number\r\n' 252 '100,2012,A,M123456,123456\r\n' 253 ) 254 return 255 209 256 class CourseTicketExporterTest(StudentImportExportSetup): 210 257 … … 276 323 return 277 324 325 def test_export_student(self): 326 # we can really export all course tickets of a certain student 327 self.setup_student(self.student) 328 exporter = CourseTicketExporter() 329 exporter.export_student(self.student, self.outfile) 330 result = open(self.outfile, 'rb').read() 331 self.assertEqual( 332 result, 333 'automatic,carry_over,code,credits,dcode,fcode,level,mandatory,' 334 'matric_number,passmark,reg_number,score,semester,title\r\n' 335 '1,1,CRS1,100,DEP1,FAC1,100,0,M123456,100,123456,0,2,Course 1\r\n' 336 ) 337 return 338 278 339 class PaymentsExporterTest(StudentImportExportSetup): 279 340 … … 284 345 self.setup_for_export() 285 346 return 286 287 def get_payment(self):288 # get a payment with all fields set289 payment = StudentOnlinePayment()290 payment.creation_date = datetime.datetime(2012, 4, 1, 13, 12, 1)291 payment.p_id = 'my-id'292 payment.ac = u'666'293 payment.p_item = u'p-item'294 payment.p_level = 100295 payment.p_session = 2012296 payment.payment_date = datetime.datetime(2012, 4, 1, 14, 12, 1)297 payment.r_amount_approved = 12.12298 payment.r_code = u'r-code'299 # XXX: there is no addPayment method to give predictable names300 self.student['payments']['my-payment'] = payment301 return payment302 347 303 348 def test_ifaces(self): … … 335 380 # set values we can expect in export file 336 381 self.setup_student(self.student) 337 payment = self. get_payment()382 payment = self.student['payments']['my-payment'] 338 383 exporter = PaymentsExporter() 339 384 exporter.export([payment], self.outfile) … … 355 400 # set values we can expect in export file 356 401 self.setup_student(self.student) 357 self.get_payment() # adds new payment to student358 402 exporter = PaymentsExporter() 359 403 exporter.export_all(self.app, self.outfile) … … 370 414 ) 371 415 return 416 417 def test_export_student(self): 418 # we can really export all payments of a certain student 419 # set values we can expect in export file 420 self.setup_student(self.student) 421 exporter = PaymentsExporter() 422 exporter.export_student(self.student, self.outfile) 423 result = open(self.outfile, 'rb').read() 424 self.assertEqual( 425 result, 426 'ac,amount_auth,creation_date,matric_number,p_category,p_id,' 427 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' 428 'r_code,reg_number\r\n' 429 430 '666,0.0,2012-04-01 13:12:01,M123456,schoolfee,my-id,' 431 'p-item,100,2012,unpaid,2012-04-01 14:12:01,12.12,' 432 'r-code,123456\r\n' 433 ) 434 return
Note: See TracChangeset for help on using the changeset viewer.