- Timestamp:
- 23 Jun 2016, 11:26:26 (8 years ago)
- Location:
- main/kofacustom.skeleton/trunk/src/kofacustom/skeleton/applicants
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.skeleton/trunk/src/kofacustom/skeleton/applicants/export.py
r13096 r13983 20 20 import grok 21 21 from waeup.kofa.applicants.interfaces import IApplicantBaseData 22 from waeup.kofa.utils.helpers import iface_names 22 23 from kofacustom.nigeria.applicants.export import NigeriaApplicantExporter 23 24 from kofacustom.nigeria.applicants.interfaces import ( … … 31 32 32 33 fields = tuple(sorted(set( 33 ICustomUGApplicant.names() + 34 ICustomPGApplicant.names() + 35 INigeriaUGApplicant.names() + 36 INigeriaPGApplicant.names() + 37 IApplicantBaseData.names() 38 ))) 34 iface_names(ICustomUGApplicant) + 35 iface_names(ICustomPGApplicant) + 36 iface_names(INigeriaUGApplicant) + 37 iface_names(INigeriaPGApplicant) + 38 iface_names(IApplicantBaseData) 39 ))) + ( 40 'password', 'state', 'history', 'container_code', 'application_number', 41 'display_fullname', 'application_date') -
main/kofacustom.skeleton/trunk/src/kofacustom/skeleton/applicants/tests/test_browser.py
r13629 r13983 70 70 return applicant 71 71 72 def test_export_reimport_all(self):73 # we can export all applicants in a portal74 # set values we can expect in export file75 self.applicant = self.setup_applicant(self.applicant)76 exporter = CustomApplicantExporter()77 exporter.export_all(self.app, self.outfile)78 result = open(self.outfile, 'rb').read()79 self.assertMatches(result,80 'aggregate,applicant_id,application_date,application_number,'81 'container_code,course1,course2,course_admitted,date_of_birth,'82 'display_fullname,email,emp2_end,emp2_position,emp2_reason,'83 'emp2_start,emp_end,emp_position,emp_reason,emp_start,employer,'84 'employer2,firstname,fst_sit_date,fst_sit_fname,fst_sit_no,'85 'fst_sit_results,fst_sit_type,history,hq_degree,hq_disc,'86 'hq_fname,hq_matric_no,hq_school,hq_session,hq_type,'87 'jamb_reg_number,jamb_score,jamb_subjects,jamb_subjects_list,'88 'lastname,lga,locked,middlename,nationality,notice,nysc_lga,'89 'nysc_year,password,phone,presently_inst,programme_type,'90 'reg_number,result_uploaded,scd_sit_date,scd_sit_fname,'91 'scd_sit_no,scd_sit_results,scd_sit_type,screening_date,'92 'screening_score,screening_venue,sex,special,special_application,'93 'state,student_id,suspended,translated_state\r\n'94 ',dp2011_654321,,654321,dp2011,CERT1,CERT1,CERT1,1981-02-04#,'95 'Anna M. Tester,anna@sample.com,,,,,,,,,,,Anna,,,,,,'96 '[u\'2016-01-17 08:15:47 WAT - Application initialized by system\']'97 ',,,,,,,,,,,,Tester,,0,M.,NG,"Some notice\nin lines.",,,'98 'any password,+234-123-12345#,,,123456,,,,,,,'99 '"Saturday, 16th June 2012 2:00:00 PM",98,Exam Room,f,,,'100 'initialized,,0,initialized\r\n')101 # We can import the same file if we ignore some columns.102 # Since the applicants_catalog hasn't been notified, the same103 # record with same reg_number can be imported twice.104 processor = CustomApplicantProcessor()105 result = processor.doImport(106 self.outfile,107 ['aggregate','ignore_applicant_id','application_date','ignore_application_number',108 'container_code','course1','course2','course_admitted','date_of_birth',109 'ignore_display_fullname','email','emp2_end','emp2_position','emp2_reason',110 'emp2_start','emp_end','emp_position','emp_reason','emp_start','employer',111 'employer2','firstname','fst_sit_date','fst_sit_fname','fst_sit_no',112 'fst_sit_results','fst_sit_type','ignore_history','hq_degree','hq_disc',113 'hq_fname','hq_matric_no','hq_school','hq_session','hq_type',114 'jamb_reg_number','jamb_score','jamb_subjects','jamb_subjects_list',115 'lastname','lga','locked','middlename','nationality','notice','nysc_lga',116 'nysc_year','password','phone','presently_inst','programme_type',117 'reg_number','result_uploaded','scd_sit_date','scd_sit_fname',118 'scd_sit_no','scd_sit_results','scd_sit_type','screening_date',119 'screening_score','screening_venue','sex','ignore_special','special_application',120 'state','student_id','suspended','ignore_translated_state'],121 mode='create')122 num_succ, num_fail, finished_path, failed_path = result123 #content = open(failed_path).read()124 self.assertEqual(num_succ,1)125 self.assertEqual(num_fail,0)126 # Now we ignore also the container_code and import the same file127 # in update mode which means that INigeriaApplicantUpdateByRegNo128 # is used for field conversion. applicant_id must be ignored129 # too since the previous import has notified the applicants_catalog130 # so that the portal 'knows' that reg_number is in use.131 processor = CustomApplicantProcessor()132 result = processor.doImport(133 self.outfile,134 ['aggregate','ignore_applicant_id','application_date','ignore_application_number',135 'ignore_container_code','course1','course2','course_admitted','date_of_birth',136 'ignore_display_fullname','email','emp2_end','emp2_position','emp2_reason',137 'emp2_start','emp_end','emp_position','emp_reason','emp_start','employer',138 'employer2','firstname','fst_sit_date','fst_sit_fname','fst_sit_no',139 'fst_sit_results','fst_sit_type','ignore_history','hq_degree','hq_disc',140 'hq_fname','hq_matric_no','hq_school','hq_session','hq_type',141 'jamb_reg_number','jamb_score','jamb_subjects','jamb_subjects_list',142 'lastname','lga','locked','middlename','nationality','notice','nysc_lga',143 'nysc_year','password','phone','presently_inst','programme_type',144 'reg_number','result_uploaded','scd_sit_date','scd_sit_fname',145 'scd_sit_no','scd_sit_results','scd_sit_type','screening_date',146 'screening_score','screening_venue','sex','ignore_special','special_application',147 'state','student_id','suspended','ignore_translated_state'],148 mode='update')149 num_succ, num_fail, finished_path, failed_path = result150 self.assertEqual(num_succ,1)151 self.assertEqual(num_fail,0)152 return153 154 72 class ApplicantsContainerUITests(ApplicantsFullSetup): 155 73 # Tests for ApplicantsContainer class views and pages
Note: See TracChangeset for help on using the changeset viewer.