1 | import os |
---|
2 | import grok |
---|
3 | import datetime |
---|
4 | from cStringIO import StringIO |
---|
5 | from zope.component import queryUtility, getUtility |
---|
6 | from zope.event import notify |
---|
7 | from zope.interface.verify import verifyObject, verifyClass |
---|
8 | from waeup.kofa.interfaces import ( |
---|
9 | ICSVExporter, IExtFileStore, IFileStoreNameChooser) |
---|
10 | from waeup.kofa.students.catalog import StudentsQuery |
---|
11 | from waeup.kofa.students.export import ( |
---|
12 | StudentsExporter, StudentStudyCourseExporter, StudentStudyLevelExporter, |
---|
13 | CourseTicketExporter, StudentPaymentsExporter, BedTicketsExporter, |
---|
14 | StudentPaymentsOverviewExporter, StudentStudyLevelsOverviewExporter, |
---|
15 | ComboCardDataExporter, |
---|
16 | get_students,) |
---|
17 | from waeup.kofa.students.accommodation import BedTicket |
---|
18 | from waeup.kofa.students.interfaces import ICSVStudentExporter |
---|
19 | from waeup.kofa.students.payments import StudentOnlinePayment |
---|
20 | from waeup.kofa.students.student import Student |
---|
21 | from waeup.kofa.students.studycourse import StudentStudyCourse |
---|
22 | from waeup.kofa.students.studylevel import StudentStudyLevel, CourseTicket |
---|
23 | from waeup.kofa.students.tests.test_batching import StudentImportExportSetup |
---|
24 | from waeup.kofa.testing import FunctionalLayer |
---|
25 | |
---|
26 | curr_year = datetime.datetime.now().year |
---|
27 | year_range = range(curr_year - 9, curr_year + 1) |
---|
28 | year_range_str = ','.join([str(i) for i in year_range]) |
---|
29 | |
---|
30 | class ExportHelperTests(StudentImportExportSetup): |
---|
31 | layer = FunctionalLayer |
---|
32 | def setUp(self): |
---|
33 | super(ExportHelperTests, self).setUp() |
---|
34 | student = Student() |
---|
35 | self.app['students'].addStudent(student) |
---|
36 | student = self.setup_student(student) |
---|
37 | notify(grok.ObjectModifiedEvent(student)) |
---|
38 | self.student = self.app['students'][student.student_id] |
---|
39 | return |
---|
40 | |
---|
41 | def test_get_students_plain(self): |
---|
42 | # without a filter we get all students |
---|
43 | result = get_students(self.app) |
---|
44 | self.assertEqual(len(list(result)), 1) |
---|
45 | return |
---|
46 | |
---|
47 | def test_get_students_by_session(self): |
---|
48 | # we can filter out students of a certain session |
---|
49 | my_filter1 = StudentsQuery(current_session=2012) |
---|
50 | result = get_students(self.app, stud_filter=my_filter1) |
---|
51 | self.assertEqual(len(list(result)), 1) |
---|
52 | |
---|
53 | my_filter2 = StudentsQuery(current_session=1964) |
---|
54 | result = get_students(self.app, stud_filter=my_filter2) |
---|
55 | self.assertEqual(len(list(result)), 0) |
---|
56 | return |
---|
57 | |
---|
58 | def test_get_students_by_level(self): |
---|
59 | # we can filter out students of a certain level |
---|
60 | my_filter1 = StudentsQuery(current_level=200) |
---|
61 | result = get_students(self.app, stud_filter=my_filter1) |
---|
62 | self.assertEqual(len(list(result)), 1) |
---|
63 | |
---|
64 | my_filter2 = StudentsQuery(current_level=300) |
---|
65 | result = get_students(self.app, stud_filter=my_filter2) |
---|
66 | self.assertEqual(len(list(result)), 0) |
---|
67 | return |
---|
68 | |
---|
69 | def test_get_students_by_deptcode(self): |
---|
70 | # we can filter out students of a certain dept. |
---|
71 | my_filter1 = StudentsQuery(depcode='NA') |
---|
72 | result = get_students(self.app, stud_filter=my_filter1) |
---|
73 | self.assertEqual(len(list(result)), 1) |
---|
74 | |
---|
75 | my_filter2 = StudentsQuery(depcode='NOTEXISTING') |
---|
76 | result = get_students(self.app, stud_filter=my_filter2) |
---|
77 | self.assertEqual(len(list(result)), 0) |
---|
78 | return |
---|
79 | |
---|
80 | def test_get_students_by_faccode(self): |
---|
81 | # we can filter out students of a certain faculty. |
---|
82 | my_filter1 = StudentsQuery(faccode='NA') |
---|
83 | result = get_students(self.app, stud_filter=my_filter1) |
---|
84 | self.assertEqual(len(list(result)), 1) |
---|
85 | |
---|
86 | my_filter2 = StudentsQuery(faccode='NOTEXISTING') |
---|
87 | result = get_students(self.app, stud_filter=my_filter2) |
---|
88 | self.assertEqual(len(list(result)), 0) |
---|
89 | return |
---|
90 | |
---|
91 | def test_get_students_by_current_mode(self): |
---|
92 | # we can filter out students in a certain mode. |
---|
93 | my_filter1 = StudentsQuery(current_mode='ug_ft') |
---|
94 | result = get_students(self.app, stud_filter=my_filter1) |
---|
95 | self.assertEqual(len(list(result)), 1) |
---|
96 | |
---|
97 | my_filter2 = StudentsQuery(current_mode='NOTEXISTING') |
---|
98 | result = get_students(self.app, stud_filter=my_filter2) |
---|
99 | self.assertEqual(len(list(result)), 0) |
---|
100 | return |
---|
101 | |
---|
102 | |
---|
103 | class StudentsExporterTest(StudentImportExportSetup): |
---|
104 | |
---|
105 | layer = FunctionalLayer |
---|
106 | |
---|
107 | std_csv_entry = ( |
---|
108 | 'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,' |
---|
109 | 'Anna,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n",,' |
---|
110 | '+234-123-12345#,123,f,A111111,0,,,created' |
---|
111 | ) |
---|
112 | |
---|
113 | def setUp(self): |
---|
114 | super(StudentsExporterTest, self).setUp() |
---|
115 | self.setup_for_export() |
---|
116 | return |
---|
117 | |
---|
118 | def test_ifaces(self): |
---|
119 | # make sure we fullfill interface contracts |
---|
120 | obj = StudentsExporter() |
---|
121 | verifyObject(ICSVStudentExporter, obj) |
---|
122 | verifyClass(ICSVStudentExporter, StudentsExporter) |
---|
123 | return |
---|
124 | |
---|
125 | def test_get_as_utility(self): |
---|
126 | # we can get an student exporter as utility |
---|
127 | result = queryUtility(ICSVExporter, name="students") |
---|
128 | self.assertTrue(result is not None) |
---|
129 | return |
---|
130 | |
---|
131 | def test_export(self): |
---|
132 | # we can really export students |
---|
133 | # set values we can expect in export file |
---|
134 | self.setup_student(self.student) |
---|
135 | exporter = StudentsExporter() |
---|
136 | exporter.export([self.student], self.outfile) |
---|
137 | result = open(self.outfile, 'rb').read() |
---|
138 | self.assertTrue( |
---|
139 | 'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,' |
---|
140 | 'firstname,lastname,matric_number,middlename,nationality,officer_comment,' |
---|
141 | 'perm_address,personal_updated,' |
---|
142 | 'phone,reg_number,sex,student_id,suspended,suspended_comment,password,' |
---|
143 | 'state,history,certcode,is_postgrad,current_level,current_session\r\n' |
---|
144 | |
---|
145 | 'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,' |
---|
146 | 'Anna,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n",,' |
---|
147 | '+234-123-12345#,123,f,A111111,0,,,created' |
---|
148 | in result |
---|
149 | ) |
---|
150 | return |
---|
151 | |
---|
152 | def test_export_all(self): |
---|
153 | # we can really export students |
---|
154 | # set values we can expect in export file |
---|
155 | self.setup_student(self.student) |
---|
156 | exporter = StudentsExporter() |
---|
157 | exporter.export_all(self.app, self.outfile) |
---|
158 | result = open(self.outfile, 'rb').read() |
---|
159 | self.assertTrue( |
---|
160 | 'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,' |
---|
161 | 'firstname,lastname,matric_number,middlename,nationality,officer_comment,' |
---|
162 | 'perm_address,personal_updated' |
---|
163 | ',phone,reg_number,sex,student_id,suspended,suspended_comment,password,' |
---|
164 | 'state,history,certcode,is_postgrad,current_level,current_session\r\n' |
---|
165 | |
---|
166 | 'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,' |
---|
167 | 'Anna,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n",,' |
---|
168 | '+234-123-12345#,123,f,A111111,0,,,created' |
---|
169 | in result |
---|
170 | ) |
---|
171 | return |
---|
172 | |
---|
173 | def test_export_student(self): |
---|
174 | # we can export a single student |
---|
175 | self.setup_student(self.student) |
---|
176 | exporter = StudentsExporter() |
---|
177 | exporter.export_student(self.student, self.outfile) |
---|
178 | result = open(self.outfile, 'rb').read() |
---|
179 | self.assertTrue( |
---|
180 | 'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,' |
---|
181 | 'firstname,lastname,matric_number,middlename,nationality,officer_comment,' |
---|
182 | 'perm_address,personal_updated' |
---|
183 | ',phone,reg_number,sex,student_id,suspended,suspended_comment,password,' |
---|
184 | 'state,history,certcode,is_postgrad,current_level,current_session\r\n' |
---|
185 | |
---|
186 | 'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,' |
---|
187 | 'Anna,Tester,234,M.,NG,,"Studentroad 21\nLagos 123456\n",,' |
---|
188 | '+234-123-12345#,123,f,A111111,0,,,created' |
---|
189 | in result |
---|
190 | ) |
---|
191 | return |
---|
192 | |
---|
193 | def test_export_filtered(self): |
---|
194 | # we can export a filtered set of students (filtered by session/level) |
---|
195 | self.setup_student(self.student) |
---|
196 | self.app['students'].addStudent(self.student) |
---|
197 | notify(grok.ObjectModifiedEvent(self.student)) |
---|
198 | exporter = StudentsExporter() |
---|
199 | |
---|
200 | exporter.export_filtered( |
---|
201 | self.app, self.outfile, |
---|
202 | current_session=None, current_level=None) |
---|
203 | result1 = open(self.outfile, 'rb').read() |
---|
204 | exporter.export_filtered( |
---|
205 | self.app, self.outfile, |
---|
206 | current_session=2012, current_level=None) |
---|
207 | result2 = open(self.outfile, 'rb').read() |
---|
208 | # current_level can be both a string ... |
---|
209 | exporter.export_filtered( |
---|
210 | self.app, self.outfile, |
---|
211 | current_session=None, current_level=u'200') |
---|
212 | result3 = open(self.outfile, 'rb').read() |
---|
213 | exporter.export_filtered( |
---|
214 | self.app, self.outfile, |
---|
215 | current_session=2011, current_level=None) |
---|
216 | result4 = open(self.outfile, 'rb').read() |
---|
217 | # ... and an integer |
---|
218 | exporter.export_filtered( |
---|
219 | self.app, self.outfile, |
---|
220 | current_session=None, current_level=100) |
---|
221 | result5 = open(self.outfile, 'rb').read() |
---|
222 | self.assertTrue(self.std_csv_entry in result1) |
---|
223 | self.assertTrue(self.std_csv_entry in result2) |
---|
224 | self.assertTrue(self.std_csv_entry in result3) |
---|
225 | self.assertTrue(self.std_csv_entry not in result4) |
---|
226 | self.assertTrue(self.std_csv_entry not in result5) |
---|
227 | return |
---|
228 | |
---|
229 | def test_export_filtered_by_dept(self): |
---|
230 | # we can export a set of students filtered by department |
---|
231 | self.setup_student(self.student) |
---|
232 | self.app['students'].addStudent(self.student) |
---|
233 | notify(grok.ObjectModifiedEvent(self.student)) |
---|
234 | exporter = StudentsExporter() |
---|
235 | # current_session can be both a string ... |
---|
236 | exporter.export_filtered( |
---|
237 | self.app, self.outfile, |
---|
238 | current_session='2012', current_level=u'200', depcode='NA') |
---|
239 | result1 = open(self.outfile, 'rb').read() |
---|
240 | # ... and an integer |
---|
241 | exporter.export_filtered( |
---|
242 | self.app, self.outfile, |
---|
243 | current_session=2012, current_level=200, depcode='NODEPT') |
---|
244 | result2 = open(self.outfile, 'rb').read() |
---|
245 | self.assertTrue(self.std_csv_entry in result1) |
---|
246 | self.assertTrue(self.std_csv_entry not in result2) |
---|
247 | return |
---|
248 | |
---|
249 | def test_export_filtered_by_faculty(self): |
---|
250 | # we can export a set of students filtered by faculty |
---|
251 | self.setup_student(self.student) |
---|
252 | self.app['students'].addStudent(self.student) |
---|
253 | notify(grok.ObjectModifiedEvent(self.student)) |
---|
254 | exporter = StudentsExporter() |
---|
255 | |
---|
256 | exporter.export_filtered( |
---|
257 | self.app, self.outfile, |
---|
258 | current_session=2012, current_level='200', faccode='NA') |
---|
259 | result1 = open(self.outfile, 'rb').read() |
---|
260 | exporter.export_filtered( |
---|
261 | self.app, self.outfile, |
---|
262 | current_session=2012, current_level=200, faccode='NOFAC') |
---|
263 | result2 = open(self.outfile, 'rb').read() |
---|
264 | self.assertTrue(self.std_csv_entry in result1) |
---|
265 | self.assertTrue(self.std_csv_entry not in result2) |
---|
266 | return |
---|
267 | |
---|
268 | class StudentStudyCourseExporterTest(StudentImportExportSetup): |
---|
269 | |
---|
270 | layer = FunctionalLayer |
---|
271 | |
---|
272 | def setUp(self): |
---|
273 | super(StudentStudyCourseExporterTest, self).setUp() |
---|
274 | self.setup_for_export() |
---|
275 | return |
---|
276 | |
---|
277 | def test_ifaces(self): |
---|
278 | # make sure we fullfill interface contracts |
---|
279 | obj = StudentStudyCourseExporter() |
---|
280 | verifyObject(ICSVStudentExporter, obj) |
---|
281 | verifyClass(ICSVStudentExporter, StudentStudyCourseExporter) |
---|
282 | return |
---|
283 | |
---|
284 | def test_get_as_utility(self): |
---|
285 | # we can get an student exporter as utility |
---|
286 | result = queryUtility(ICSVExporter, name="studentstudycourses") |
---|
287 | self.assertTrue(result is not None) |
---|
288 | return |
---|
289 | |
---|
290 | def test_export_empty(self): |
---|
291 | # we can export a nearly empty study course |
---|
292 | study_course = StudentStudyCourse() |
---|
293 | exporter = StudentStudyCourseExporter() |
---|
294 | exporter.export([study_course], self.outfile) |
---|
295 | result = open(self.outfile, 'rb').read() |
---|
296 | self.assertEqual( |
---|
297 | result, |
---|
298 | 'certificate,current_level,current_session,current_verdict,' |
---|
299 | 'entry_mode,entry_session,previous_verdict,student_id\r\n' |
---|
300 | |
---|
301 | ',,,0,,,0,\r\n' |
---|
302 | ) |
---|
303 | return |
---|
304 | |
---|
305 | def test_export(self): |
---|
306 | # we can really export study courses. |
---|
307 | # set values we can expect in export file |
---|
308 | self.setup_student(self.student) |
---|
309 | study_course = self.student.get('studycourse') |
---|
310 | exporter = StudentStudyCourseExporter() |
---|
311 | exporter.export([study_course], self.outfile) |
---|
312 | result = open(self.outfile, 'rb').read() |
---|
313 | self.assertEqual( |
---|
314 | result, |
---|
315 | 'certificate,current_level,current_session,current_verdict,' |
---|
316 | 'entry_mode,entry_session,previous_verdict,student_id\r\n' |
---|
317 | |
---|
318 | 'CERT1,200,2012,0,ug_ft,2010,0,A111111\r\n' |
---|
319 | ) |
---|
320 | return |
---|
321 | |
---|
322 | def test_export_all(self): |
---|
323 | # we can really export students |
---|
324 | # set values we can expect in export file |
---|
325 | self.setup_student(self.student) |
---|
326 | exporter = StudentStudyCourseExporter() |
---|
327 | exporter.export_all(self.app, self.outfile) |
---|
328 | result = open(self.outfile, 'rb').read() |
---|
329 | self.assertEqual( |
---|
330 | result, |
---|
331 | 'certificate,current_level,current_session,current_verdict,' |
---|
332 | 'entry_mode,entry_session,previous_verdict,student_id\r\n' |
---|
333 | |
---|
334 | 'CERT1,200,2012,0,ug_ft,2010,0,A111111\r\n' |
---|
335 | ) |
---|
336 | return |
---|
337 | |
---|
338 | def test_export_student(self): |
---|
339 | # we can export studycourse of a certain student |
---|
340 | self.setup_student(self.student) |
---|
341 | exporter = StudentStudyCourseExporter() |
---|
342 | exporter.export_student(self.student, self.outfile) |
---|
343 | result = open(self.outfile, 'rb').read() |
---|
344 | self.assertEqual( |
---|
345 | result, |
---|
346 | 'certificate,current_level,current_session,current_verdict,' |
---|
347 | 'entry_mode,entry_session,previous_verdict,student_id\r\n' |
---|
348 | |
---|
349 | 'CERT1,200,2012,0,ug_ft,2010,0,A111111\r\n' |
---|
350 | ) |
---|
351 | return |
---|
352 | |
---|
353 | def test_export_filtered(self): |
---|
354 | # we can export studycourses of a filtered set of students |
---|
355 | self.setup_student(self.student) |
---|
356 | self.app['students'].addStudent(self.student) |
---|
357 | notify(grok.ObjectModifiedEvent(self.student)) |
---|
358 | |
---|
359 | exporter = StudentStudyCourseExporter() |
---|
360 | exporter.export_filtered( |
---|
361 | self.student, self.outfile, current_session=2012) |
---|
362 | result = open(self.outfile, 'rb').read() |
---|
363 | self.assertEqual( |
---|
364 | result, |
---|
365 | 'certificate,current_level,current_session,current_verdict,' |
---|
366 | 'entry_mode,entry_session,previous_verdict,student_id\r\n' |
---|
367 | |
---|
368 | 'CERT1,200,2012,0,ug_ft,2010,0,A111111\r\n' |
---|
369 | ) |
---|
370 | return |
---|
371 | |
---|
372 | |
---|
373 | |
---|
374 | class StudentStudyLevelExporterTest(StudentImportExportSetup): |
---|
375 | |
---|
376 | layer = FunctionalLayer |
---|
377 | |
---|
378 | def setUp(self): |
---|
379 | super(StudentStudyLevelExporterTest, self).setUp() |
---|
380 | self.setup_for_export() |
---|
381 | return |
---|
382 | |
---|
383 | def test_ifaces(self): |
---|
384 | # make sure we fullfill interface contracts |
---|
385 | obj = StudentStudyLevelExporter() |
---|
386 | verifyObject(ICSVStudentExporter, obj) |
---|
387 | verifyClass(ICSVStudentExporter, StudentStudyLevelExporter) |
---|
388 | return |
---|
389 | |
---|
390 | def test_get_as_utility(self): |
---|
391 | # we can get an student exporter as utility |
---|
392 | result = queryUtility(ICSVExporter, name="studentstudylevels") |
---|
393 | self.assertTrue(result is not None) |
---|
394 | return |
---|
395 | |
---|
396 | def test_export_empty(self): |
---|
397 | # we can export a nearly empty study level |
---|
398 | study_level = StudentStudyLevel() |
---|
399 | exporter = StudentStudyLevelExporter() |
---|
400 | exporter.export([study_level], self.outfile) |
---|
401 | result = open(self.outfile, 'rb').read() |
---|
402 | self.assertEqual( |
---|
403 | result, |
---|
404 | 'gpa,level,level_session,level_verdict,total_credits,' |
---|
405 | 'validated_by,validation_date,' |
---|
406 | 'student_id,number_of_tickets,certcode\r\n' |
---|
407 | '0.0,,,0,0,,,,0,\r\n' |
---|
408 | ) |
---|
409 | return |
---|
410 | |
---|
411 | def test_export(self): |
---|
412 | # we can really export study levels. |
---|
413 | # set values we can expect in export file |
---|
414 | self.setup_student(self.student) |
---|
415 | study_course = self.student.get('studycourse') |
---|
416 | study_level = study_course[study_course.keys()[0]] |
---|
417 | exporter = StudentStudyLevelExporter() |
---|
418 | exporter.export([study_level], self.outfile) |
---|
419 | result = open(self.outfile, 'rb').read() |
---|
420 | self.assertEqual( |
---|
421 | result, |
---|
422 | 'gpa,level,level_session,level_verdict,total_credits,' |
---|
423 | 'validated_by,validation_date,' |
---|
424 | 'student_id,number_of_tickets,certcode\r\n' |
---|
425 | '0.0,100,2012,A,100,,,A111111,1,CERT1\r\n' |
---|
426 | ) |
---|
427 | return |
---|
428 | |
---|
429 | def test_export_all(self): |
---|
430 | # we can really export study levels |
---|
431 | # set values we can expect in export file |
---|
432 | self.setup_student(self.student) |
---|
433 | exporter = StudentStudyLevelExporter() |
---|
434 | exporter.export_all(self.app, self.outfile) |
---|
435 | result = open(self.outfile, 'rb').read() |
---|
436 | self.assertEqual( |
---|
437 | result, |
---|
438 | 'gpa,level,level_session,level_verdict,total_credits,' |
---|
439 | 'validated_by,validation_date,' |
---|
440 | 'student_id,number_of_tickets,certcode\r\n' |
---|
441 | '0.0,100,2012,A,100,,,A111111,1,CERT1\r\n' |
---|
442 | ) |
---|
443 | return |
---|
444 | |
---|
445 | def test_export_student(self): |
---|
446 | # we can really export study levels of a certain student |
---|
447 | self.setup_student(self.student) |
---|
448 | exporter = StudentStudyLevelExporter() |
---|
449 | exporter.export_student(self.student, self.outfile) |
---|
450 | result = open(self.outfile, 'rb').read() |
---|
451 | self.assertEqual( |
---|
452 | result, |
---|
453 | 'gpa,level,level_session,level_verdict,total_credits,' |
---|
454 | 'validated_by,validation_date,' |
---|
455 | 'student_id,number_of_tickets,certcode\r\n' |
---|
456 | '0.0,100,2012,A,100,,,A111111,1,CERT1\r\n' |
---|
457 | ) |
---|
458 | return |
---|
459 | |
---|
460 | def test_export_filtered(self): |
---|
461 | # we can export studylevels of a filtered set of students |
---|
462 | self.setup_student(self.student) |
---|
463 | self.app['students'].addStudent(self.student) |
---|
464 | notify(grok.ObjectModifiedEvent(self.student)) |
---|
465 | |
---|
466 | exporter = StudentStudyLevelExporter() |
---|
467 | exporter.export_filtered( |
---|
468 | self.student, self.outfile, current_level=200) |
---|
469 | result = open(self.outfile, 'rb').read() |
---|
470 | self.assertEqual( |
---|
471 | result, |
---|
472 | 'gpa,level,level_session,level_verdict,total_credits,' |
---|
473 | 'validated_by,validation_date,' |
---|
474 | 'student_id,number_of_tickets,certcode\r\n' |
---|
475 | '0.0,100,2012,A,100,,,A111111,1,CERT1\r\n' |
---|
476 | ) |
---|
477 | return |
---|
478 | |
---|
479 | class CourseTicketExporterTest(StudentImportExportSetup): |
---|
480 | |
---|
481 | layer = FunctionalLayer |
---|
482 | |
---|
483 | def setUp(self): |
---|
484 | super(CourseTicketExporterTest, self).setUp() |
---|
485 | self.setup_for_export() |
---|
486 | return |
---|
487 | |
---|
488 | def test_ifaces(self): |
---|
489 | # make sure we fullfill interface contracts |
---|
490 | obj = CourseTicketExporter() |
---|
491 | verifyObject(ICSVStudentExporter, obj) |
---|
492 | verifyClass(ICSVStudentExporter, CourseTicketExporter) |
---|
493 | return |
---|
494 | |
---|
495 | def test_get_as_utility(self): |
---|
496 | # we can get an student exporter as utility |
---|
497 | result = queryUtility(ICSVExporter, name="coursetickets") |
---|
498 | self.assertTrue(result is not None) |
---|
499 | return |
---|
500 | |
---|
501 | def test_export_empty(self): |
---|
502 | # we can export a nearly empty course ticket |
---|
503 | ticket = CourseTicket() |
---|
504 | exporter = CourseTicketExporter() |
---|
505 | exporter.export([ticket], self.outfile) |
---|
506 | result = open(self.outfile, 'rb').read() |
---|
507 | self.assertEqual( |
---|
508 | result, |
---|
509 | 'automatic,carry_over,code,credits,dcode,fcode,level,level_session,' |
---|
510 | 'mandatory,passmark,score,semester,title,student_id,certcode\r\n' |
---|
511 | '0,0,,,,,,,0,,,,,,\r\n' |
---|
512 | ) |
---|
513 | return |
---|
514 | |
---|
515 | def test_export(self): |
---|
516 | # we can really export course tickets. |
---|
517 | # set values we can expect in export file |
---|
518 | self.setup_student(self.student) |
---|
519 | study_course = self.student.get('studycourse') |
---|
520 | study_level = study_course[study_course.keys()[0]] |
---|
521 | ticket = study_level['CRS1'] |
---|
522 | exporter = CourseTicketExporter() |
---|
523 | exporter.export([ticket], self.outfile) |
---|
524 | result = open(self.outfile, 'rb').read() |
---|
525 | self.assertEqual( |
---|
526 | result, |
---|
527 | 'automatic,carry_over,code,credits,dcode,fcode,level,level_session,' |
---|
528 | 'mandatory,passmark,score,semester,title,student_id,certcode\r\n' |
---|
529 | '1,1,CRS1,100,DEP1,FAC1,100,2012,0,100,,2,Course 1,A111111,CERT1\r\n' |
---|
530 | ) |
---|
531 | return |
---|
532 | |
---|
533 | def test_export_all(self): |
---|
534 | # we can really export all course tickets |
---|
535 | # set values we can expect in export file |
---|
536 | self.setup_student(self.student) |
---|
537 | exporter = CourseTicketExporter() |
---|
538 | exporter.export_all(self.app, self.outfile) |
---|
539 | result = open(self.outfile, 'rb').read() |
---|
540 | self.assertEqual( |
---|
541 | result, |
---|
542 | 'automatic,carry_over,code,credits,dcode,fcode,level,level_session,' |
---|
543 | 'mandatory,passmark,score,semester,title,student_id,certcode\r\n' |
---|
544 | '1,1,CRS1,100,DEP1,FAC1,100,2012,0,100,,2,Course 1,A111111,CERT1\r\n' |
---|
545 | ) |
---|
546 | return |
---|
547 | |
---|
548 | def test_export_student(self): |
---|
549 | # we can really export all course tickets of a certain student |
---|
550 | self.setup_student(self.student) |
---|
551 | exporter = CourseTicketExporter() |
---|
552 | exporter.export_student(self.student, self.outfile) |
---|
553 | result = open(self.outfile, 'rb').read() |
---|
554 | self.assertEqual( |
---|
555 | result, |
---|
556 | 'automatic,carry_over,code,credits,dcode,fcode,level,level_session,' |
---|
557 | 'mandatory,passmark,score,semester,title,student_id,certcode\r\n' |
---|
558 | '1,1,CRS1,100,DEP1,FAC1,100,2012,0,100,,2,Course 1,A111111,CERT1\r\n' |
---|
559 | ) |
---|
560 | return |
---|
561 | |
---|
562 | def test_export_filtered(self): |
---|
563 | # we can export course tickets of a filtered set of students |
---|
564 | self.setup_student(self.student) |
---|
565 | self.app['students'].addStudent(self.student) |
---|
566 | notify(grok.ObjectModifiedEvent(self.student)) |
---|
567 | |
---|
568 | exporter = CourseTicketExporter() |
---|
569 | exporter.export_filtered( |
---|
570 | self.student, self.outfile, current_level=200) |
---|
571 | result = open(self.outfile, 'rb').read() |
---|
572 | self.assertEqual( |
---|
573 | result, |
---|
574 | 'automatic,carry_over,code,credits,dcode,fcode,level,level_session,' |
---|
575 | 'mandatory,passmark,score,semester,title,student_id,certcode\r\n' |
---|
576 | '1,1,CRS1,100,DEP1,FAC1,100,2012,0,100,,2,Course 1,A111111,CERT1\r\n' |
---|
577 | ) |
---|
578 | # if the coursetickets catalog is used to filter students |
---|
579 | # and (course) code is not None |
---|
580 | # only course tickets which belong to this course are exported |
---|
581 | exporter.export_filtered( |
---|
582 | self.student, self.outfile, catalog='coursetickets', code='CRS1') |
---|
583 | result = open(self.outfile, 'rb').read() |
---|
584 | self.assertEqual( |
---|
585 | result, |
---|
586 | 'automatic,carry_over,code,credits,dcode,fcode,level,level_session,' |
---|
587 | 'mandatory,passmark,score,semester,title,student_id,certcode\r\n' |
---|
588 | '1,1,CRS1,100,DEP1,FAC1,100,2012,0,100,,2,Course 1,A111111,CERT1\r\n' |
---|
589 | ) |
---|
590 | exporter.export_filtered( |
---|
591 | self.student, self.outfile, catalog='coursetickets', code='any code') |
---|
592 | result = open(self.outfile, 'rb').read() |
---|
593 | self.assertEqual( |
---|
594 | result, |
---|
595 | 'automatic,carry_over,code,credits,dcode,fcode,level,level_session,' |
---|
596 | 'mandatory,passmark,score,semester,title,student_id,certcode\r\n' |
---|
597 | ) |
---|
598 | return |
---|
599 | |
---|
600 | class StudentPaymentsExporterTest(StudentImportExportSetup): |
---|
601 | |
---|
602 | layer = FunctionalLayer |
---|
603 | |
---|
604 | def setUp(self): |
---|
605 | super(StudentPaymentsExporterTest, self).setUp() |
---|
606 | self.setup_for_export() |
---|
607 | return |
---|
608 | |
---|
609 | def test_ifaces(self): |
---|
610 | # make sure we fullfill interface contracts |
---|
611 | obj = StudentPaymentsExporter() |
---|
612 | verifyObject(ICSVStudentExporter, obj) |
---|
613 | verifyClass(ICSVStudentExporter, StudentPaymentsExporter) |
---|
614 | return |
---|
615 | |
---|
616 | def test_get_as_utility(self): |
---|
617 | # we can get a payments exporter as utility |
---|
618 | result = queryUtility(ICSVExporter, name="studentpayments") |
---|
619 | self.assertTrue(result is not None) |
---|
620 | return |
---|
621 | |
---|
622 | def test_export_empty(self): |
---|
623 | # we can export a nearly empty payment |
---|
624 | payment = StudentOnlinePayment() |
---|
625 | payment.creation_date = datetime.datetime(2012, 4, 1, 13, 12, 1) |
---|
626 | exporter = StudentPaymentsExporter() |
---|
627 | exporter.export([payment], self.outfile) |
---|
628 | result = open(self.outfile, 'rb').read() |
---|
629 | self.assertEqual( |
---|
630 | result, |
---|
631 | 'ac,amount_auth,creation_date,p_category,p_current,p_id,' |
---|
632 | 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' |
---|
633 | 'r_code,r_desc,student_id,student_state,current_session\r\n' |
---|
634 | |
---|
635 | ',0.0,2012-04-01 13:12:01,schoolfee,1,,,,,unpaid,,0.0,,,,,\r\n' |
---|
636 | ) |
---|
637 | return |
---|
638 | |
---|
639 | def test_export(self): |
---|
640 | # we can really export student payments. |
---|
641 | # set values we can expect in export file |
---|
642 | self.setup_student(self.student) |
---|
643 | payment = self.student['payments']['my-payment'] |
---|
644 | exporter = StudentPaymentsExporter() |
---|
645 | exporter.export([payment], self.outfile) |
---|
646 | result = open(self.outfile, 'rb').read() |
---|
647 | self.assertEqual( |
---|
648 | result, |
---|
649 | 'ac,amount_auth,creation_date,p_category,p_current,p_id,' |
---|
650 | 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' |
---|
651 | 'r_code,r_desc,student_id,student_state,current_session\r\n' |
---|
652 | |
---|
653 | '666,0.0,2012-04-01 13:12:01,schoolfee,1,my-id,' |
---|
654 | 'p-item,100,2012,unpaid,2012-04-01 14:12:01,12.12,' |
---|
655 | 'r-code,,A111111,created,2012\r\n' |
---|
656 | ) |
---|
657 | return |
---|
658 | |
---|
659 | def test_export_all(self): |
---|
660 | # we can really export all payments |
---|
661 | # set values we can expect in export file |
---|
662 | self.setup_student(self.student) |
---|
663 | exporter = StudentPaymentsExporter() |
---|
664 | exporter.export_all(self.app, self.outfile) |
---|
665 | result = open(self.outfile, 'rb').read() |
---|
666 | self.assertEqual( |
---|
667 | result, |
---|
668 | 'ac,amount_auth,creation_date,p_category,p_current,p_id,' |
---|
669 | 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' |
---|
670 | 'r_code,r_desc,student_id,student_state,current_session\r\n' |
---|
671 | |
---|
672 | '666,0.0,2012-04-01 13:12:01,schoolfee,1,my-id,' |
---|
673 | 'p-item,100,2012,unpaid,2012-04-01 14:12:01,12.12,' |
---|
674 | 'r-code,,A111111,created,2012\r\n' |
---|
675 | ) |
---|
676 | return |
---|
677 | |
---|
678 | def test_export_student(self): |
---|
679 | # we can really export all payments of a certain student |
---|
680 | # set values we can expect in export file |
---|
681 | self.setup_student(self.student) |
---|
682 | exporter = StudentPaymentsExporter() |
---|
683 | exporter.export_student(self.student, self.outfile) |
---|
684 | result = open(self.outfile, 'rb').read() |
---|
685 | self.assertEqual( |
---|
686 | result, |
---|
687 | 'ac,amount_auth,creation_date,p_category,p_current,p_id,' |
---|
688 | 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' |
---|
689 | 'r_code,r_desc,student_id,student_state,current_session\r\n' |
---|
690 | |
---|
691 | '666,0.0,2012-04-01 13:12:01,schoolfee,1,my-id,' |
---|
692 | 'p-item,100,2012,unpaid,2012-04-01 14:12:01,12.12,' |
---|
693 | 'r-code,,A111111,created,2012\r\n' |
---|
694 | ) |
---|
695 | return |
---|
696 | |
---|
697 | def test_export_filtered(self): |
---|
698 | # we can export payments of a filtered set of students |
---|
699 | self.setup_student(self.student) |
---|
700 | self.app['students'].addStudent(self.student) |
---|
701 | notify(grok.ObjectModifiedEvent(self.student)) |
---|
702 | |
---|
703 | exporter = StudentPaymentsExporter() |
---|
704 | exporter.export_filtered( |
---|
705 | self.student, self.outfile, current_level=200) |
---|
706 | result = open(self.outfile, 'rb').read() |
---|
707 | self.assertEqual( |
---|
708 | result, |
---|
709 | 'ac,amount_auth,creation_date,p_category,p_current,p_id,' |
---|
710 | 'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,' |
---|
711 | 'r_code,r_desc,student_id,student_state,current_session\r\n' |
---|
712 | |
---|
713 | '666,0.0,2012-04-01 13:12:01,schoolfee,1,my-id,' |
---|
714 | 'p-item,100,2012,unpaid,2012-04-01 14:12:01,12.12,' |
---|
715 | 'r-code,,A111111,created,2012\r\n' |
---|
716 | ) |
---|
717 | return |
---|
718 | |
---|
719 | class BedTicketsExporterTest(StudentImportExportSetup): |
---|
720 | |
---|
721 | layer = FunctionalLayer |
---|
722 | |
---|
723 | def setUp(self): |
---|
724 | super(BedTicketsExporterTest, self).setUp() |
---|
725 | self.setup_for_export() |
---|
726 | return |
---|
727 | |
---|
728 | def test_ifaces(self): |
---|
729 | # make sure we fullfill interface contracts |
---|
730 | obj = BedTicketsExporter() |
---|
731 | verifyObject(ICSVStudentExporter, obj) |
---|
732 | verifyClass(ICSVStudentExporter, BedTicketsExporter) |
---|
733 | return |
---|
734 | |
---|
735 | def test_get_as_utility(self): |
---|
736 | # we can get a bedtickets exporter as utility |
---|
737 | result = queryUtility(ICSVExporter, name="bedtickets") |
---|
738 | self.assertTrue(result is not None) |
---|
739 | return |
---|
740 | |
---|
741 | def test_export_empty(self): |
---|
742 | # we can export a nearly empty bedticket |
---|
743 | bedticket = BedTicket() |
---|
744 | bed = self.app['hostels']['hall-1']['hall-1_A_101_A'] |
---|
745 | bedticket.bed = bed |
---|
746 | exporter = BedTicketsExporter() |
---|
747 | exporter.export([bedticket], self.outfile) |
---|
748 | result = open(self.outfile, 'rb').read() |
---|
749 | self.assertMatches( |
---|
750 | result, |
---|
751 | 'bed,bed_coordinates,bed_type,booking_code,booking_date,' |
---|
752 | 'booking_session,student_id,actual_bed_type\r\n' |
---|
753 | 'hall-1_A_101_A,,,,<YYYY-MM-DD hh:mm:ss>.<6-DIGITS>,,,regular_male_fr\r\n' |
---|
754 | ) |
---|
755 | return |
---|
756 | |
---|
757 | def test_export(self): |
---|
758 | # we can really export student bedtickets. |
---|
759 | # set values we can expect in export file |
---|
760 | self.setup_student(self.student) |
---|
761 | bedticket = self.student['accommodation']['2004'] |
---|
762 | exporter = BedTicketsExporter() |
---|
763 | exporter.export([bedticket], self.outfile) |
---|
764 | result = open(self.outfile, 'rb').read() |
---|
765 | self.assertMatches( |
---|
766 | result, |
---|
767 | 'bed,bed_coordinates,bed_type,booking_code,booking_date,' |
---|
768 | 'booking_session,student_id,actual_bed_type\r\n' |
---|
769 | 'hall-1_A_101_A,,any bed type,,<YYYY-MM-DD hh:mm:ss>.<6-DIGITS>,2004,' |
---|
770 | 'A111111,regular_male_fr\r\n' |
---|
771 | ) |
---|
772 | return |
---|
773 | |
---|
774 | def test_export_all(self): |
---|
775 | # we can really export all bedtickets |
---|
776 | # set values we can expect in export file |
---|
777 | self.setup_student(self.student) |
---|
778 | exporter = BedTicketsExporter() |
---|
779 | exporter.export_all(self.app, self.outfile) |
---|
780 | result = open(self.outfile, 'rb').read() |
---|
781 | self.assertMatches( |
---|
782 | result, |
---|
783 | 'bed,bed_coordinates,bed_type,booking_code,booking_date,' |
---|
784 | 'booking_session,student_id,actual_bed_type\r\n' |
---|
785 | 'hall-1_A_101_A,,any bed type,,<YYYY-MM-DD hh:mm:ss>.<6-DIGITS>,2004,' |
---|
786 | 'A111111,regular_male_fr\r\n' |
---|
787 | ) |
---|
788 | return |
---|
789 | |
---|
790 | def test_export_student(self): |
---|
791 | # we can really export all bedtickets of a certain student |
---|
792 | # set values we can expect in export file |
---|
793 | self.setup_student(self.student) |
---|
794 | exporter = BedTicketsExporter() |
---|
795 | exporter.export_student(self.student, self.outfile) |
---|
796 | result = open(self.outfile, 'rb').read() |
---|
797 | self.assertMatches( |
---|
798 | result, |
---|
799 | 'bed,bed_coordinates,bed_type,booking_code,booking_date,' |
---|
800 | 'booking_session,student_id,actual_bed_type\r\n' |
---|
801 | 'hall-1_A_101_A,,any bed type,,<YYYY-MM-DD hh:mm:ss>.<6-DIGITS>,2004,' |
---|
802 | 'A111111,regular_male_fr\r\n' |
---|
803 | ) |
---|
804 | return |
---|
805 | |
---|
806 | def test_export_filtered(self): |
---|
807 | # we can export payments of a filtered set of students |
---|
808 | self.setup_student(self.student) |
---|
809 | self.app['students'].addStudent(self.student) |
---|
810 | notify(grok.ObjectModifiedEvent(self.student)) |
---|
811 | |
---|
812 | exporter = BedTicketsExporter() |
---|
813 | exporter.export_filtered( |
---|
814 | self.student, self.outfile, current_level=200) |
---|
815 | result = open(self.outfile, 'rb').read() |
---|
816 | self.assertMatches( |
---|
817 | result, |
---|
818 | 'bed,bed_coordinates,bed_type,booking_code,booking_date,' |
---|
819 | 'booking_session,student_id,actual_bed_type\r\n' |
---|
820 | 'hall-1_A_101_A,,any bed type,,<YYYY-MM-DD hh:mm:ss>.<6-DIGITS>,' |
---|
821 | '2004,A111111,regular_male_fr\r\n') |
---|
822 | return |
---|
823 | |
---|
824 | |
---|
825 | class StudentPaymentsOverviewExporterTest(StudentImportExportSetup): |
---|
826 | |
---|
827 | layer = FunctionalLayer |
---|
828 | |
---|
829 | def setUp(self): |
---|
830 | super(StudentPaymentsOverviewExporterTest, self).setUp() |
---|
831 | self.setup_for_export() |
---|
832 | return |
---|
833 | |
---|
834 | def test_ifaces(self): |
---|
835 | # make sure we fullfill interface contracts |
---|
836 | obj = StudentPaymentsOverviewExporter() |
---|
837 | verifyObject(ICSVStudentExporter, obj) |
---|
838 | verifyClass(ICSVStudentExporter, StudentPaymentsOverviewExporter) |
---|
839 | return |
---|
840 | |
---|
841 | def test_get_as_utility(self): |
---|
842 | # we can get a payments exporter as utility |
---|
843 | result = queryUtility(ICSVExporter, name="paymentsoverview") |
---|
844 | self.assertTrue(result is not None) |
---|
845 | return |
---|
846 | |
---|
847 | def test_export(self): |
---|
848 | self.setup_student(self.student) |
---|
849 | exporter = StudentPaymentsOverviewExporter() |
---|
850 | exporter.export([self.student], self.outfile) |
---|
851 | result = open(self.outfile, 'rb').read() |
---|
852 | self.assertEqual( |
---|
853 | 'student_id,state,certcode,faccode,depcode,is_postgrad,' |
---|
854 | 'current_level,current_session,current_mode,' |
---|
855 | '%s\r\n' |
---|
856 | 'A111111,created,CERT1,NA,NA,0,200,2012,ug_ft,' |
---|
857 | ',,,,,,,,,\r\n' % year_range_str, |
---|
858 | result |
---|
859 | ) |
---|
860 | return |
---|
861 | |
---|
862 | def test_export_all(self): |
---|
863 | # we can really export students |
---|
864 | # set values we can expect in export file |
---|
865 | self.setup_student(self.student) |
---|
866 | # We add successful payments |
---|
867 | payment = StudentOnlinePayment() |
---|
868 | payment.p_id = 'my-id' |
---|
869 | payment.p_session = 2009 |
---|
870 | payment.amount_auth = 12.12 |
---|
871 | payment.p_state = u'paid' |
---|
872 | self.student['payments']['my-2ndpayment'] = payment |
---|
873 | exporter = StudentPaymentsOverviewExporter() |
---|
874 | exporter.export_all(self.app, self.outfile) |
---|
875 | result = open(self.outfile, 'rb').read() |
---|
876 | self.assertEqual( |
---|
877 | 'student_id,state,certcode,faccode,depcode,is_postgrad,' |
---|
878 | 'current_level,current_session,current_mode,' |
---|
879 | '%s\r\nA111111,created,CERT1,NA,NA,0,' |
---|
880 | '200,2012,ug_ft,,,,,,12.12,,,,\r\n' % year_range_str, |
---|
881 | result |
---|
882 | ) |
---|
883 | return |
---|
884 | |
---|
885 | class StudentStudyLevelsOverviewExporterTest(StudentImportExportSetup): |
---|
886 | |
---|
887 | layer = FunctionalLayer |
---|
888 | |
---|
889 | def setUp(self): |
---|
890 | super(StudentStudyLevelsOverviewExporterTest, self).setUp() |
---|
891 | self.setup_for_export() |
---|
892 | return |
---|
893 | |
---|
894 | def test_ifaces(self): |
---|
895 | obj = StudentStudyLevelsOverviewExporter() |
---|
896 | verifyObject(ICSVStudentExporter, obj) |
---|
897 | verifyClass(ICSVStudentExporter, StudentStudyLevelsOverviewExporter) |
---|
898 | return |
---|
899 | |
---|
900 | def test_get_as_utility(self): |
---|
901 | result = queryUtility(ICSVExporter, name="studylevelsoverview") |
---|
902 | self.assertTrue(result is not None) |
---|
903 | return |
---|
904 | |
---|
905 | def test_export(self): |
---|
906 | self.setup_student(self.student) |
---|
907 | exporter = StudentStudyLevelsOverviewExporter() |
---|
908 | exporter.export([self.student], self.outfile) |
---|
909 | result = open(self.outfile, 'rb').read() |
---|
910 | self.assertEqual( |
---|
911 | 'student_id,state,certcode,faccode,depcode,is_postgrad,' |
---|
912 | 'entry_session,current_level,current_session,' |
---|
913 | '10,100,110,120,200,210,220,300,310,320,400,410,420,500,' |
---|
914 | '510,520,600,610,620,700,710,720,800,810,820,900,910,920,999\r\n' |
---|
915 | 'A111111,created,CERT1,NA,NA,0,2010,200,2012,,2012' |
---|
916 | ',,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n', |
---|
917 | result |
---|
918 | ) |
---|
919 | return |
---|
920 | |
---|
921 | def test_export_all(self): |
---|
922 | self.setup_student(self.student) |
---|
923 | exporter = StudentStudyLevelsOverviewExporter() |
---|
924 | exporter.export_all(self.app, self.outfile) |
---|
925 | result = open(self.outfile, 'rb').read() |
---|
926 | self.assertEqual( |
---|
927 | 'student_id,state,certcode,faccode,depcode,is_postgrad,' |
---|
928 | 'entry_session,current_level,current_session,' |
---|
929 | '10,100,110,120,200,210,220,300,310,320,400,410,420,500,' |
---|
930 | '510,520,600,610,620,700,710,720,800,810,820,900,910,920,999\r\n' |
---|
931 | 'A111111,created,CERT1,NA,NA,0,2010,200,2012,,2012' |
---|
932 | ',,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n', |
---|
933 | result |
---|
934 | ) |
---|
935 | return |
---|
936 | |
---|
937 | class ComboCardExporterTest(StudentImportExportSetup): |
---|
938 | |
---|
939 | layer = FunctionalLayer |
---|
940 | |
---|
941 | def setUp(self): |
---|
942 | super(ComboCardExporterTest, self).setUp() |
---|
943 | self.setup_for_export() |
---|
944 | return |
---|
945 | |
---|
946 | def create_passport_img(self, student): |
---|
947 | # create some passport file for `student` |
---|
948 | storage = getUtility(IExtFileStore) |
---|
949 | image_path = os.path.join(os.path.dirname(__file__), 'test_image.jpg') |
---|
950 | self.image_contents = open(image_path, 'rb').read() |
---|
951 | file_id = IFileStoreNameChooser(student).chooseName( |
---|
952 | attr='passport.jpg') |
---|
953 | storage.createFile(file_id, StringIO(self.image_contents)) |
---|
954 | |
---|
955 | def test_export_all(self): |
---|
956 | self.setup_student(self.student) |
---|
957 | self.create_passport_img(self.student) |
---|
958 | exporter = ComboCardDataExporter() |
---|
959 | exporter.export_all(self.app, self.outfile) |
---|
960 | result = open(self.outfile, 'rb').read() |
---|
961 | self.assertTrue( |
---|
962 | 'display_fullname,student_id,matric_number,certificate,faculty,' |
---|
963 | 'department,passport_path\r\nAnna M. Tester,A111111,234,' |
---|
964 | 'Unnamed Certificate,Faculty of Unnamed Faculty (NA),' |
---|
965 | 'Department of Unnamed Department (NA),' |
---|
966 | 'students/00110/A111111/passport_A111111.jpg\r\n' |
---|
967 | in result |
---|
968 | ) |
---|
969 | return |
---|