- Timestamp:
- 1 Aug 2024, 11:02:51 (3 months ago)
- Location:
- main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_browser.py
r17611 r17866 456 456 return 457 457 458 def test_final_clearance(self): 459 self.app['users'].addUser('mrbursary', SECRET) 460 self.app['users']['mrbursary'].email = 'mrbursary@foo.ng' 461 self.app['users']['mrbursary'].title = u'Carl Pitter' 462 # Clearance officers needs to get 463 # the StudentsOfficer site role 464 prmglobal = IPrincipalRoleManager(self.app) 465 prmglobal.assignRoleToPrincipal('waeup.StudentsOfficer', 'mrbursary') 466 # Assign BursaryOfficer role 467 prmglobal.assignRoleToPrincipal('waeup.BursaryOfficer', 'mrbursary') 468 # and FinalClearanceOfficer role 469 prmglobal.assignRoleToPrincipal( 470 'waeup.FinalClearanceOfficer', 'mrbursary') 471 # Login 472 self.browser.open(self.login_path) 473 self.browser.getControl(name="form.login").value = 'mrbursary' 474 self.browser.getControl(name="form.password").value = SECRET 475 self.browser.getControl("Login").click() 476 # BO can see his roles 477 self.browser.getLink("My Roles").click() 478 self.assertMatches( 479 '...<div>Bursary Officer</div>...', 480 self.browser.contents) 481 # BO can view student record 482 self.browser.open(self.student_path) 483 # BO can see clearance button ... 484 self.assertTrue( 485 'Clear student finally' in self.browser.contents) 486 # ... but not withdraw button 487 self.assertFalse( 488 'Withdraw final clearance' in self.browser.contents) 489 # BO can clear student 490 self.browser.getLink("Clear student finally").click() 491 self.assertTrue( 492 'Student has been finally cleared' in self.browser.contents) 493 # Name of BO and date have been stored 494 self.assertEqual(self.student.finally_cleared_by, 'Carl Pitter') 495 self.assertMatches( 496 '<YYYY-MM-DD hh:mm:ss>', 497 self.student.final_clearance_date.strftime( 498 "%Y-%m-%d %H:%M:%S")) 499 # BO can't see clearance button ... 500 self.assertFalse( 501 'Clear student finally' in self.browser.contents) 502 # ... but withdraw button and can withdraw clearance 503 self.browser.getLink("Withdraw final clearance").click() 504 self.assertTrue( 505 'Final clearance withdrawn' in self.browser.contents) 506 # Name of BO and date have been deleted 507 self.assertEqual(self.student.finally_cleared_by, None) 508 self.assertEqual(self.student.final_clearance_date, None) 509 # Clearance is logged 510 logfile = os.path.join( 511 self.app['datacenter'].storage, 'logs', 'students.log') 512 logcontent = open(logfile).read() 513 self.assertTrue( 514 'mrbursary - kofacustom.nigeria.students.browser.ClearStudentFinally' 515 ' - K1000000 - finally cleared' in logcontent) 516 self.assertTrue( 517 'mrbursary - kofacustom.nigeria.students.browser.WithdrawFinalClearance' 518 ' - K1000000 - final clearance withdrawn' in logcontent) 519 # Clearance is also stored in the history 520 self.browser.open(self.history_path) 521 self.assertMatches( 522 '...2016-01-16 15:50:48 WAT - Finally cleared by Carl Pitter...', 523 self.browser.contents) 524 self.assertMatches( 525 '...2016-01-16 15:50:48 WAT - Final clearance withdrawn by Carl Pitter...', 526 self.browser.contents) 527 458 528 def test_provisionally_cleared(self): 459 529 # Students can edit clearance data -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_export.py
r17246 r17866 71 71 'emp2_position,emp2_reason,emp2_start,emp_end,emp_position,' 72 72 'emp_reason,emp_start,employer,employer2,' 73 'final_clearance_date,finally_cleared_by,' 73 74 'financial_clearance_date,financially_cleared_by,' 74 75 'firstname,flash_notice,former_matric,' … … 87 88 'current_level,current_session\r\nmy adm code,,,,' 88 89 '"[(\'accounts\', \'A\')]",my clr code,1981-02-04#,,,' 89 'anna@sample.com,,,,,,,,,,,,, Anna,,,,,,"[(\'accounts\', \'A\')]"'90 'anna@sample.com,,,,,,,,,,,,,,,Anna,,,,,,"[(\'accounts\', \'A\')]"' 90 91 ',,,,,,,,,,,,,,,,Tester,,,234,M.,NG,,,,,,,,,,' 91 92 '"Studentroad 21\nLagos 123456\n",,+234-123-12345#,,,123,,,,,'
Note: See TracChangeset for help on using the changeset viewer.