Changeset 14093 for main/kofacustom.nigeria/trunk/src/kofacustom
- Timestamp:
- 19 Aug 2016, 06:53:34 (8 years ago)
- Location:
- main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants/browser.py
r14062 r14093 24 24 from zope.formlib.textwidgets import BytesDisplayWidget 25 25 from waeup.kofa.students.interfaces import IStudentsUtils 26 from waeup.kofa.applicants.interfaces import IApplicantRegisterUpdate27 26 from waeup.kofa.applicants.browser import (ApplicantDisplayFormPage, 28 27 ApplicantManageFormPage, ApplicantEditFormPage, 29 ApplicantRegistrationPage, ApplicantAddFormPage,30 OnlinePaymentDisplayFormPage, ApplicationFeePaymentAddPage,28 ApplicantRegistrationPage, 29 OnlinePaymentDisplayFormPage, 31 30 OnlinePaymentBreadcrumb, ExportPDFPaymentSlipPage, 32 ApplicantBaseDisplayFormPage)31 ) 33 32 from waeup.kofa.applicants.viewlets import ( 34 P aymentReceiptActionButton, PDFActionButton)33 PDFActionButton) 35 34 from waeup.kofa.applicants.pdf import PDFApplicationSlip 36 35 from kofacustom.nigeria.applicants.interfaces import ( 37 36 INigeriaPGApplicant, INigeriaUGApplicant, 38 37 INigeriaPGApplicantEdit, INigeriaUGApplicantEdit, 39 INigeriaApplicantOnlinePayment, IPUTMEApplicantEdit,38 INigeriaApplicantOnlinePayment, 40 39 UG_OMIT_DISPLAY_FIELDS, 41 40 UG_OMIT_PDF_FIELDS, 42 41 UG_OMIT_MANAGE_FIELDS, 43 42 UG_OMIT_EDIT_FIELDS, 44 CBT_OMIT_DISPLAY_FIELDS,45 CBT_OMIT_PDF_FIELDS,46 CBT_OMIT_MANAGE_FIELDS,47 CBT_OMIT_EDIT_FIELDS,48 AFFIL_OMIT_DISPLAY_FIELDS,49 AFFIL_OMIT_PDF_FIELDS,50 AFFIL_OMIT_MANAGE_FIELDS,51 AFFIL_OMIT_EDIT_FIELDS,52 43 PG_OMIT_DISPLAY_FIELDS, 53 44 PG_OMIT_PDF_FIELDS, 54 45 PG_OMIT_MANAGE_FIELDS, 55 46 PG_OMIT_EDIT_FIELDS, 56 PUTME_OMIT_DISPLAY_FIELDS,57 PUTME_OMIT_PDF_FIELDS,58 PUTME_OMIT_MANAGE_FIELDS,59 PUTME_OMIT_EDIT_FIELDS,60 PUTME_OMIT_RESULT_SLIP_FIELDS,61 PUDE_OMIT_DISPLAY_FIELDS,62 PUDE_OMIT_PDF_FIELDS,63 PUDE_OMIT_MANAGE_FIELDS,64 PUDE_OMIT_EDIT_FIELDS,65 PUDE_OMIT_RESULT_SLIP_FIELDS,66 PRE_OMIT_DISPLAY_FIELDS,67 PRE_OMIT_PDF_FIELDS,68 PRE_OMIT_MANAGE_FIELDS,69 PRE_OMIT_EDIT_FIELDS,70 47 ) 71 48 from kofacustom.nigeria.interfaces import MessageFactory as _ … … 96 73 form_fields = grok.AutoFields(INigeriaPGApplicant) 97 74 for field in PG_OMIT_DISPLAY_FIELDS: 98 form_fields = form_fields.omit(field)99 elif self.target is not None and self.target.startswith('pre'):100 form_fields = grok.AutoFields(INigeriaPGApplicant)101 for field in PRE_OMIT_DISPLAY_FIELDS:102 form_fields = form_fields.omit(field)103 elif self.target is not None and self.target.startswith('cbt'): #uniben104 form_fields = grok.AutoFields(INigeriaUGApplicant)105 for field in CBT_OMIT_DISPLAY_FIELDS:106 form_fields = form_fields.omit(field)107 elif self.target is not None and self.target.startswith('akj'): # uniben108 form_fields = grok.AutoFields(INigeriaPGApplicant)109 for field in PRE_OMIT_DISPLAY_FIELDS:110 form_fields = form_fields.omit(field)111 elif self.target is not None and self.target.startswith('ak'): # uniben112 form_fields = grok.AutoFields(INigeriaUGApplicant)113 for field in AFFIL_OMIT_DISPLAY_FIELDS:114 form_fields = form_fields.omit(field)115 elif self.target is not None and self.target.startswith('ase'): # was putme116 form_fields = grok.AutoFields(INigeriaUGApplicant)117 for field in PUTME_OMIT_DISPLAY_FIELDS:118 form_fields = form_fields.omit(field)119 elif self.target is not None and self.target.startswith('pude'):120 form_fields = grok.AutoFields(INigeriaUGApplicant)121 for field in PUDE_OMIT_DISPLAY_FIELDS:122 75 form_fields = form_fields.omit(field) 123 76 else: … … 154 107 for field in PG_OMIT_PDF_FIELDS: 155 108 form_fields = form_fields.omit(field) 156 elif self.target is not None and self.target.startswith('pre'):157 form_fields = grok.AutoFields(INigeriaPGApplicant)158 for field in PRE_OMIT_PDF_FIELDS:159 form_fields = form_fields.omit(field)160 elif self.target is not None and self.target.startswith('cbt'): # uniben161 form_fields = grok.AutoFields(INigeriaUGApplicant)162 for field in CBT_OMIT_PDF_FIELDS:163 form_fields = form_fields.omit(field)164 elif self.target is not None and self.target.startswith('akj'): # uniben165 form_fields = grok.AutoFields(INigeriaPGApplicant)166 for field in PRE_OMIT_PDF_FIELDS:167 form_fields = form_fields.omit(field)168 elif self.target is not None and self.target.startswith('ak'): # uniben169 form_fields = grok.AutoFields(INigeriaUGApplicant)170 for field in AFFIL_OMIT_PDF_FIELDS:171 form_fields = form_fields.omit(field)172 elif self.target is not None and self.target.startswith('ase'): # was putme173 form_fields = grok.AutoFields(INigeriaUGApplicant)174 if self._reduced_slip():175 for field in PUTME_OMIT_RESULT_SLIP_FIELDS:176 form_fields = form_fields.omit(field)177 else:178 for field in PUTME_OMIT_PDF_FIELDS:179 form_fields = form_fields.omit(field)180 elif self.target is not None and self.target.startswith('pude'):181 form_fields = grok.AutoFields(INigeriaUGApplicant)182 if self._reduced_slip():183 for field in PUDE_OMIT_RESULT_SLIP_FIELDS:184 form_fields = form_fields.omit(field)185 else:186 for field in PUDE_OMIT_PDF_FIELDS:187 form_fields = form_fields.omit(field)188 109 else: 189 110 form_fields = grok.AutoFields(INigeriaUGApplicant) … … 210 131 for field in PG_OMIT_MANAGE_FIELDS: 211 132 form_fields = form_fields.omit(field) 212 elif self.target is not None and self.target.startswith('pre'):213 form_fields = grok.AutoFields(INigeriaPGApplicant)214 for field in PRE_OMIT_MANAGE_FIELDS:215 form_fields = form_fields.omit(field)216 elif self.target is not None and self.target.startswith('cbt'): # uniben217 form_fields = grok.AutoFields(INigeriaUGApplicant)218 for field in CBT_OMIT_MANAGE_FIELDS:219 form_fields = form_fields.omit(field)220 elif self.target is not None and self.target.startswith('akj'): # uniben221 form_fields = grok.AutoFields(INigeriaPGApplicant)222 for field in PRE_OMIT_MANAGE_FIELDS:223 form_fields = form_fields.omit(field)224 elif self.target is not None and self.target.startswith('ak'): # uniben225 form_fields = grok.AutoFields(INigeriaUGApplicant)226 for field in AFFIL_OMIT_MANAGE_FIELDS:227 form_fields = form_fields.omit(field)228 elif self.target is not None and self.target.startswith('ase'): # was putme229 form_fields = grok.AutoFields(INigeriaUGApplicant)230 for field in PUTME_OMIT_MANAGE_FIELDS:231 form_fields = form_fields.omit(field)232 elif self.target is not None and self.target.startswith('pude'):233 form_fields = grok.AutoFields(INigeriaUGApplicant)234 for field in PUDE_OMIT_MANAGE_FIELDS:235 form_fields = form_fields.omit(field)236 133 else: 237 134 form_fields = grok.AutoFields(INigeriaUGApplicant) … … 251 148 form_fields = grok.AutoFields(INigeriaPGApplicantEdit) 252 149 for field in PG_OMIT_EDIT_FIELDS: 253 form_fields = form_fields.omit(field)254 elif self.target is not None and self.target.startswith('pre'):255 form_fields = grok.AutoFields(INigeriaPGApplicantEdit)256 for field in PRE_OMIT_EDIT_FIELDS:257 form_fields = form_fields.omit(field)258 elif self.target is not None and self.target.startswith('cbt'): # uniben259 form_fields = grok.AutoFields(INigeriaUGApplicantEdit)260 for field in CBT_OMIT_EDIT_FIELDS:261 form_fields = form_fields.omit(field)262 elif self.target is not None and self.target.startswith('akj'): # uniben263 form_fields = grok.AutoFields(INigeriaPGApplicant)264 for field in PRE_OMIT_EDIT_FIELDS:265 form_fields = form_fields.omit(field)266 elif self.target is not None and self.target.startswith('ak'): # uniben267 form_fields = grok.AutoFields(INigeriaUGApplicantEdit)268 for field in AFFIL_OMIT_EDIT_FIELDS:269 form_fields = form_fields.omit(field)270 elif self.target is not None and self.target.startswith('ase'): # was putme271 form_fields = grok.AutoFields(IPUTMEApplicantEdit)272 for field in PUTME_OMIT_EDIT_FIELDS:273 form_fields = form_fields.omit(field)274 elif self.target is not None and self.target.startswith('pude'):275 form_fields = grok.AutoFields(INigeriaUGApplicantEdit)276 for field in PUDE_OMIT_EDIT_FIELDS:277 150 form_fields = form_fields.omit(field) 278 151 else: -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants/tests/test_browser.py
r13979 r14093 365 365 self.browser.getControl(name="form.course1").value = ['CERT1'] 366 366 self.browser.getControl("Save").click() 367 #self.assertMatches('...Not exactly 4 items selected...', self.browser.contents)368 # Since the testbrowser does not support Javascrip we can't test the369 # save action which clears jamb_subjects_list on the edit form page370 # An error would be raised.371 372 # If we login as manager, we can use the manage form page.373 self.browser.open(self.logout_path)374 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')375 self.cbtapplicant.jamb_subjects_list = [376 'english_language', 'fine_art', 'mathematics', 'physics']377 self.browser.open(self.cbtapplicant_path + '/manage')378 self.browser.getControl(name="form.date_of_birth").value = '09/09/1988'379 self.browser.getControl(name="form.lga").value = ['foreigner']380 self.browser.getControl(name="form.nationality").value = ['NG']381 self.browser.getControl(name="form.sex").value = ['m']382 self.browser.getControl(name="form.email").value = 'xx@yy.zz'383 self.browser.getControl(name="form.course1").value = ['CERT1']384 self.browser.getControl(name="form.reg_number").value = '1234'385 self.browser.getControl("Save").click()386 367 self.assertMatches('...Form has been saved...', self.browser.contents) 387 # The save action on this form pages, if called with the testbrowser,388 # replaces jamb_subjects_list by an empty list (and not by None).389 self.assertEqual(self.cbtapplicant.jamb_subjects_list, [])390 368 391 369 class ApplicantExporterTest(ApplicantImportExportSetup): … … 432 410 result = open(self.outfile, 'rb').read() 433 411 self.assertMatches(result, 434 'aggregate,applicant_id, course1,course2,course_admitted,'435 ' date_of_birth,email,emp2_end,emp2_position,emp2_reason,'436 'emp2_ start,emp_end,emp_position,emp_reason,emp_start,employer,'437 'emp loyer2,firstname,fst_sit_date,fst_sit_fname,fst_sit_no,'438 'f st_sit_results,fst_sit_type,hq_degree,hq_disc,hq_fname,'439 ' hq_matric_no,hq_school,hq_session,hq_type,jamb_reg_number,'440 ' jamb_score,jamb_subjects,jamb_subjects_list,lastname,lga,'441 ' locked,middlename,nationality,notice,nysc_lga,nysc_year,'442 ' phone,presently_inst,programme_type,reg_number,result_uploaded,'443 ' scd_sit_date,scd_sit_fname,scd_sit_no,scd_sit_results,'444 ' scd_sit_type,screening_date,screening_score,screening_venue,'445 's ex,special_application,student_id,suspended,password,state,'446 ' history,container_code,application_number,display_fullname,'447 ' application_date\r\n'448 449 ',dp2011_654321,CERT1,CERT1,CERT1,1981-02-04#,' 450 ' anna@sample.com,,,,,,,,,,,Anna,,,,,,,,,,,,,,,'451 ' Line 1++Line 2,"[\'english_language\', \'fine_art\']",'452 ' Tester,,0,M.,NG,"Some notice\nin lines.",,,'453 ' +234-123-12345#,,,123456,,,,,,,'454 ' "Saturday, 16th June 2012 2:00:00 PM",98,Exam Room,f,,,'455 ' 0,any password,initialized,'456 '[u\'2016-0 6-23 10:58:23WAT - Application initialized by system\'],'412 'aggregate,applicant_id,bank_account_name,bank_account_number,' 413 'bank_name,course1,course2,course_admitted,date_of_birth,email,' 414 'emp2_end,emp2_position,emp2_reason,emp2_start,emp_end,' 415 'emp_position,emp_reason,emp_start,employer,employer2,' 416 'firstname,fst_sit_date,fst_sit_fname,fst_sit_no,' 417 'fst_sit_results,fst_sit_type,hq_degree,hq_disc,' 418 'hq_fname,hq_matric_no,hq_school,hq_session,hq_type,' 419 'jamb_reg_number,jamb_score,jamb_subjects,jamb_subjects_list,' 420 'lastname,lga,locked,middlename,nationality,notice,nysc_lga,' 421 'nysc_year,phone,presently_inst,programme_type,reg_number,' 422 'result_uploaded,scd_sit_date,scd_sit_fname,scd_sit_no,' 423 'scd_sit_results,scd_sit_type,screening_date,screening_score,' 424 'screening_venue,sex,special_application,student_id,' 425 'suspended,password,state,history,container_code,' 426 'application_number,display_fullname,application_date\r\n' 427 428 ',dp2011_654321,,,,CERT1,CERT1,CERT1,1981-02-04#,' 429 'anna@sample.com,,,,,,,,,,,Anna,,,,,,,,,,,,,,,Line 1++Line 2,' 430 '"[\'english_language\', \'fine_art\']",' 431 'Tester,,0,M.,NG,"Some notice\nin lines.",,,+234-123-12345#,,,' 432 '123456,,,,,,,"Saturday, 16th June 2012 2:00:00 PM",98,' 433 'Exam Room,f,,,0,any password,initialized,' 434 '[u\'2016-08-19 07:30:05 WAT - Application initialized by system\'],' 457 435 'dp2011,654321,Anna M. Tester,\r\n') 458 436 # We can import the same file if we ignore some columns. … … 463 441 self.outfile, 464 442 [ 465 'aggregate','ignore_applicant_id','course1','course2','course_admitted', 466 'date_of_birth','email','emp2_end','emp2_position','emp2_reason', 467 'emp2_start','emp_end','emp_position','emp_reason','emp_start','employer', 468 'employer2','firstname','fst_sit_date','fst_sit_fname','fst_sit_no', 469 'fst_sit_results','fst_sit_type','hq_degree','hq_disc','hq_fname', 470 'hq_matric_no','hq_school','hq_session','hq_type','jamb_reg_number', 471 'jamb_score','jamb_subjects','jamb_subjects_list','lastname','lga', 472 'locked','middlename','nationality','notice','nysc_lga','nysc_year', 473 'phone','presently_inst','programme_type','reg_number','result_uploaded', 474 'scd_sit_date','scd_sit_fname','scd_sit_no','scd_sit_results', 475 'scd_sit_type','screening_date','screening_score','screening_venue', 476 'sex','special_application','student_id','suspended','password','state', 477 'ignore_history','container_code','ignore_application_number','display_fullname', 478 'application_date' 443 'aggregate','ignore_applicant_id','bank_account_name','bank_account_number', 444 'bank_name','course1','course2','course_admitted','date_of_birth','email', 445 'emp2_end','emp2_position','emp2_reason','emp2_start','emp_end', 446 'emp_position','emp_reason','emp_start','employer','employer2', 447 'firstname','fst_sit_date','fst_sit_fname','fst_sit_no', 448 'fst_sit_results','fst_sit_type','hq_degree','hq_disc', 449 'hq_fname','hq_matric_no','hq_school','hq_session','hq_type', 450 'jamb_reg_number','jamb_score','jamb_subjects','jamb_subjects_list', 451 'lastname','lga','locked','middlename','nationality','notice','nysc_lga', 452 'nysc_year','phone','presently_inst','programme_type','reg_number', 453 'result_uploaded','scd_sit_date','scd_sit_fname','scd_sit_no', 454 'scd_sit_results','scd_sit_type','screening_date','screening_score', 455 'screening_venue','sex','special_application','student_id', 456 'suspended','password','state','history','container_code', 457 'application_number','display_fullname','application_date' 479 458 ], 480 459 mode='create') … … 492 471 self.outfile, 493 472 [ 494 'aggregate','ignore_applicant_id','course1','course2','course_admitted', 495 'date_of_birth','email','emp2_end','emp2_position','emp2_reason', 496 'emp2_start','emp_end','emp_position','emp_reason','emp_start','employer', 497 'employer2','firstname','fst_sit_date','fst_sit_fname','fst_sit_no', 498 'fst_sit_results','fst_sit_type','hq_degree','hq_disc','hq_fname', 499 'hq_matric_no','hq_school','hq_session','hq_type','jamb_reg_number', 500 'jamb_score','jamb_subjects','jamb_subjects_list','lastname','lga', 501 'locked','middlename','nationality','notice','nysc_lga','nysc_year', 502 'phone','presently_inst','programme_type','reg_number','result_uploaded', 503 'scd_sit_date','scd_sit_fname','scd_sit_no','scd_sit_results', 504 'scd_sit_type','screening_date','screening_score','screening_venue', 505 'sex','special_application','student_id','suspended','password','state', 506 'ignore_history','ignore_container_code','ignore_application_number', 507 'display_fullname','application_date' 473 'aggregate','ignore_applicant_id','bank_account_name','bank_account_number', 474 'bank_name','course1','course2','course_admitted','date_of_birth','email', 475 'emp2_end','emp2_position','emp2_reason','emp2_start','emp_end', 476 'emp_position','emp_reason','emp_start','employer','employer2', 477 'firstname','fst_sit_date','fst_sit_fname','fst_sit_no', 478 'fst_sit_results','fst_sit_type','hq_degree','hq_disc', 479 'hq_fname','hq_matric_no','hq_school','hq_session','hq_type', 480 'jamb_reg_number','jamb_score','jamb_subjects','jamb_subjects_list', 481 'lastname','lga','locked','middlename','nationality','notice','nysc_lga', 482 'nysc_year','phone','presently_inst','programme_type','reg_number', 483 'result_uploaded','scd_sit_date','scd_sit_fname','scd_sit_no', 484 'scd_sit_results','scd_sit_type','screening_date','screening_score', 485 'screening_venue','sex','special_application','student_id', 486 'suspended','password','state','ignore_history','ignore_container_code', 487 'ignore_application_number','display_fullname','application_date' 508 488 ], 509 489 mode='update')
Note: See TracChangeset for help on using the changeset viewer.