Changeset 11687 for main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/tests/test_browser.py
- Timestamp:
- 16 Jun 2014, 08:29:22 (10 years ago)
- Location:
- main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.sampleuni/trunk/src/kofacustom/sampleuni/applicants/tests/test_browser.py
r11543 r11687 24 24 from zope.catalog.interfaces import ICatalog 25 25 from zope.intid.interfaces import IIntIds 26 from kofacustom.skeleton.testing import FunctionalLayer 26 from kofacustom.sampleuni.testing import FunctionalLayer 27 from waeup.kofa.schoolgrades import ResultEntry 28 from waeup.kofa.utils.utils import KofaUtils 27 29 from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup 28 30 from waeup.kofa.applicants.tests.test_batching import ApplicantImportExportSetup 29 from kofacustom.s keleton.applicants.export import CustomApplicantsExporter30 from kofacustom.s keleton.applicants.batching import CustomApplicantProcessor31 from kofacustom.sampleuni.applicants.export import CustomApplicantsExporter 32 from kofacustom.sampleuni.applicants.batching import CustomApplicantProcessor 31 33 32 34 class CustomApplicantUITests(ApplicantsFullSetup): … … 53 55 applicant.lastname = u'Tester' 54 56 applicant.middlename = u'M.' 55 applicant.nationality = u'NG'56 57 applicant.date_of_birth = datetime.date(1981, 2, 4) 57 58 applicant.sex = 'f' … … 62 63 applicant.course_admitted = self.certificate 63 64 applicant.notice = u'Some notice\nin lines.' 64 applicant.screening_score = 9865 applicant.screening_venue = u'Exam Room'66 applicant.screening_date = u'Saturday, 16th June 2012 2:00:00 PM'67 65 applicant.password = 'any password' 66 result_entry = ResultEntry( 67 KofaUtils.EXAM_SUBJECTS_DICT.keys()[0], 68 KofaUtils.EXAM_GRADES[0][0] 69 ) 70 applicant.school_grades = [ 71 result_entry] 68 72 return applicant 69 73 … … 75 79 exporter.export_all(self.app, self.outfile) 76 80 result = open(self.outfile, 'rb').read() 77 self.assertMatches(result, 78 'aggregate,applicant_id,application_date,application_number,' 79 'course1,course2,course_admitted,date_of_birth,display_fullname,' 80 'email,emp2_end,emp2_position,emp2_reason,emp2_start,emp_end,' 81 'emp_position,emp_reason,emp_start,employer,employer2,' 82 'firstname,history,hq_degree,hq_disc,hq_matric_no,hq_school,' 83 'hq_session,hq_type,jamb_score,jamb_subjects,lastname,lga,' 84 'locked,middlename,nationality,notice,nysc_lga,nysc_year,' 85 'password,phone,pp_school,presently_inst,reg_number,' 86 'result_uploaded,screening_date,screening_score,' 87 'screening_venue,sex,special_application,' 88 'state,student_id,suspended,container_code\r\n' 89 ',dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,' 90 'Anna M. Tester,anna@sample.com,,,,,,,,,,,Anna,' 91 '[u\'2012-10-28 21:27:52 WAT - Application initialized by system\']' 92 ',,,,,,,,,Tester,,0,M.,NG,"Some notice\nin lines.",,,' 93 'any password,+234-123-12345#,,,123456,,' 94 '"Saturday, 16th June 2012 2:00:00 PM",98,Exam Room,f,,initialized,,' 95 '0,dp2011\r\n') 81 self.assertTrue( 82 'applicant_id,application_date,application_number,course1,course2,' 83 'course_admitted,date_of_birth,display_fullname,email,firstname,' 84 'history,lastname,locked,middlename,notice,password,phone,' 85 'reg_number,sex,special_application,state,' 86 'student_id,suspended,container_code\r\n' 87 'dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,' 88 'Anna M. Tester,anna@sample.com,Anna,' 89 in result) 90 self.assertTrue( 91 'Application initialized by system\'],' 92 'Tester,0,M.,"Some notice\nin lines.",any password,' 93 '+234-123-12345#,123456,f,,initialized,,0,dp2011\r\n' 94 in result) 96 95 # We can import the same file if we ignore some columns. 97 96 # Since the applicants_catalog hasn't been notified, the same … … 100 99 result = processor.doImport( 101 100 self.outfile, 102 [' aggreagate','ignore_applicant_id','application_date',101 ['ignore_applicant_id','application_date', 103 102 'ignore_application_number','course1','course2', 104 'course_admitted','date_of_birth','ignore3','email','emp2_end', 105 'emp2_position','emp2_reason','emp2_start','emp_end','emp_position', 106 'emp_reason','emp_start','employer','employer2','firstname','ignore4', 107 'hq_degree','hq_disc','hq_matric_no','hq_school','hq_session','hq_type', 108 'jamb_score','jamb_subjects','lastname','lga','locked','middlename', 109 'nationality','notice','nysc_lga', 110 'nysc_year','password','phone','pp_school','presently_inst', 111 'reg_number','result_uploaded', 112 'screening_date','screening_score','screening_venue','sex', 113 'special_application', 114 'state','student_id','suspended','container_code'], 103 'course_admitted','date_of_birth', 104 'ignore_display_fullname','email','firstname', 105 'ignore_history','lastname','locked','middlename', 106 'notice','password','phone', 107 'reg_number','sex','special_application','state', 108 'student_id','suspended','container_code'], 115 109 mode='create') 116 110 num_succ, num_fail, finished_path, failed_path = result … … 118 112 self.assertEqual(num_succ,1) 119 113 self.assertEqual(num_fail,0) 120 # Now we ignore also the container_code and import the same file121 # in update mode which means that INigeriaApplicantUpdateByRegNo122 # is used for field conversion. applicant_id must be ignored123 # too since the previous import has notified the applicants_catalog124 # so that the portal 'knows' that reg_number is in use.125 processor = CustomApplicantProcessor()126 result = processor.doImport(127 self.outfile,128 ['aggregate','ignore_applicant_id','application_date',129 'ignore_application_number','course1','course2',130 'course_admitted','date_of_birth','ignore3','email','emp2_end',131 'emp2_position','emp2_reason','emp2_start','emp_end','emp_position',132 'emp_reason','emp_start','employer','employer2','firstname','ignore4',133 'hq_degree','hq_disc','hq_matric_no','hq_school','hq_session','hq_type',134 'jamb_score','jamb_subjects','lastname','lga','locked','middlename',135 'nationality','notice','nysc_lga',136 'nysc_year','password','phone','pp_school','presently_inst',137 'reg_number','result_uploaded','screening_date','screening_score',138 'screening_venue','sex','special_application',139 'state','student_id','suspended','ignore_container_code'],140 mode='update')141 num_succ, num_fail, finished_path, failed_path = result142 self.assertEqual(num_succ,1)143 self.assertEqual(num_fail,0)144 114 return
Note: See TracChangeset for help on using the changeset viewer.