Changeset 7993 for main/waeup.kofa/trunk/src/waeup/kofa/students/tests
- Timestamp:
- 27 Mar 2012, 20:59:30 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students/tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r7983 r7993 109 109 self.student_path = self.container_path + '/' + self.student_id 110 110 self.manage_student_path = self.student_path + '/manage_base' 111 self.clearance_student_path = self.student_path + '/view_clearance' 112 self.personal_student_path = self.student_path + '/view_personal' 113 self.edit_clearance_student_path = self.student_path + '/edit_clearance' 114 self.edit_personal_student_path = self.student_path + '/edit_personal' 115 self.studycourse_student_path = self.student_path + '/studycourse' 116 self.payments_student_path = self.student_path + '/payments' 117 self.acco_student_path = self.student_path + '/accommodation' 118 self.history_student_path = self.student_path + '/history' 111 self.clearance_path = self.student_path + '/view_clearance' 112 self.personal_path = self.student_path + '/view_personal' 113 self.edit_clearance_path = self.student_path + '/cedit' 114 self.manage_clearance_path = self.student_path + '/edit_clearance' 115 self.edit_personal_path = self.student_path + '/edit_personal' 116 self.studycourse_path = self.student_path + '/studycourse' 117 self.payments_path = self.student_path + '/payments' 118 self.acco_path = self.student_path + '/accommodation' 119 self.history_path = self.student_path + '/history' 119 120 120 121 # Create 5 access codes with prefix'PWD' … … 399 400 self.browser.getLink("Clearance Data").click() 400 401 self.assertEqual(self.browser.headers['Status'], '200 Ok') 401 self.assertEqual(self.browser.url, self.clearance_ student_path)402 self.assertEqual(self.browser.url, self.clearance_path) 402 403 self.browser.getLink("Manage").click() 403 404 self.assertEqual(self.browser.headers['Status'], '200 Ok') 404 self.assertEqual(self.browser.url, self. edit_clearance_student_path)405 self.assertEqual(self.browser.url, self.manage_clearance_path) 405 406 self.browser.getControl(name="form.date_of_birth").value = '09/10/1961' 406 407 self.browser.getControl("Save").click() … … 411 412 self.browser.getLink("Personal Data").click() 412 413 self.assertEqual(self.browser.headers['Status'], '200 Ok') 413 self.assertEqual(self.browser.url, self.personal_ student_path)414 self.assertEqual(self.browser.url, self.personal_path) 414 415 self.browser.getLink("Edit").click() 415 416 self.assertEqual(self.browser.headers['Status'], '200 Ok') 416 self.assertEqual(self.browser.url, self.edit_personal_ student_path)417 self.assertEqual(self.browser.url, self.edit_personal_path) 417 418 self.browser.getControl("Save").click() 418 419 self.assertMatches('...Form has been saved...', … … 423 424 self.browser.getLink("Payments").click() 424 425 self.assertEqual(self.browser.headers['Status'], '200 Ok') 425 self.assertEqual(self.browser.url, self.payments_ student_path)426 self.assertEqual(self.browser.url, self.payments_path) 426 427 self.browser.open(self.student_path) 427 428 self.browser.getLink("Accommodation").click() 428 429 self.assertEqual(self.browser.headers['Status'], '200 Ok') 429 self.assertEqual(self.browser.url, self.acco_ student_path)430 self.assertEqual(self.browser.url, self.acco_path) 430 431 self.browser.open(self.student_path) 431 432 self.browser.getLink("History").click() 432 433 self.assertEqual(self.browser.headers['Status'], '200 Ok') 433 self.assertEqual(self.browser.url, self.history_ student_path)434 self.assertEqual(self.browser.url, self.history_path) 434 435 self.assertMatches('...Student admitted by Manager...', 435 436 self.browser.contents) … … 477 478 # The image is stored even if form has errors 478 479 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 479 self.browser.open(self. edit_clearance_student_path)480 self.browser.open(self.manage_clearance_path) 480 481 # No birth certificate has been uploaded yet 481 482 # Browsing the link shows a placerholder image … … 486 487 # Create a pseudo image file and select it to be uploaded in form 487 488 # as birth certificate 488 self.browser.open(self. edit_clearance_student_path)489 self.browser.open(self.manage_clearance_path) 489 490 pseudo_image = StringIO('I pretend to be a graphics file') 490 491 ctrl = self.browser.getControl(name='birthcertificateupload') … … 514 515 self.assertEqual(len(self.browser.contents), 31) 515 516 # Reuploading a file which is bigger than 150k will raise an error 516 self.browser.open(self. edit_clearance_student_path)517 self.browser.open(self.manage_clearance_path) 517 518 photo_content = 'A' * 1024 * 151 # A string of 21 KB size 518 519 pseudo_image = StringIO(photo_content) … … 551 552 'birth_certificate deleted' in self.browser.contents) 552 553 # Managers can add and delete second file 553 self.browser.open(self. edit_clearance_student_path)554 self.browser.open(self.manage_clearance_path) 554 555 pseudo_image = StringIO('I pretend to be a graphics file') 555 556 ctrl = self.browser.getControl(name='birthcertificateupload') … … 609 610 self.browser.getLink("Study Course").click() 610 611 self.assertEqual(self.browser.headers['Status'], '200 Ok') 611 self.assertEqual(self.browser.url, self.studycourse_ student_path)612 self.assertEqual(self.browser.url, self.studycourse_path) 612 613 self.assertTrue('Undergraduate Full-Time' in self.browser.contents) 613 614 self.browser.getLink("Manage").click() … … 840 841 self.browser.contents) 841 842 # CO can view the student ... 842 self.browser.open(self.clearance_ student_path)843 self.assertEqual(self.browser.headers['Status'], '200 Ok') 844 self.assertEqual(self.browser.url, self.clearance_ student_path)843 self.browser.open(self.clearance_path) 844 self.assertEqual(self.browser.headers['Status'], '200 Ok') 845 self.assertEqual(self.browser.url, self.clearance_path) 845 846 # ... but not other students 846 847 other_student = Student() … … 853 854 Unauthorized, self.browser.open, other_student_path) 854 855 # Only in state clearance requested the CO does see the 'Clear' button 855 self.browser.open(self.clearance_ student_path)856 self.browser.open(self.clearance_path) 856 857 self.assertFalse('Clear student' in self.browser.contents) 857 858 IWorkflowInfo(self.student).fireTransition('request_clearance') 858 self.browser.open(self.clearance_ student_path)859 self.browser.open(self.clearance_path) 859 860 self.assertTrue('Clear student' in self.browser.contents) 860 861 self.browser.getLink("Clear student").click() … … 869 870 self.assertTrue('clearance started' in self.browser.contents) 870 871 IWorkflowInfo(self.student).fireTransition('request_clearance') 871 self.browser.open(self.clearance_ student_path)872 self.browser.open(self.clearance_path) 872 873 self.browser.getLink("Reject clearance").click() 873 874 self.assertTrue('Clearance request has been rejected' … … 941 942 self.student['studycourse'].addStudentStudyLevel( 942 943 cert,studylevel) 943 L110_student_path = self.studycourse_ student_path + '/110'944 L110_student_path = self.studycourse_path + '/110' 944 945 # Only in state courses registered and only if the current level 945 946 # corresponds with the name of the study level object … … 958 959 self.student['studycourse'].addStudentStudyLevel( 959 960 cert,studylevel2) 960 L200_student_path = self.studycourse_ student_path + '/200'961 L200_student_path = self.studycourse_path + '/200' 961 962 self.browser.open(L200_student_path) 962 963 self.assertFalse('Validate' in self.browser.contents) … … 1220 1221 # if certain requirements are met 1221 1222 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 1222 self.browser.open(self.payments_ student_path)1223 self.browser.open(self.payments_path) 1223 1224 self.browser.getControl("Add online payment ticket").click() 1224 1225 self.browser.getControl(name="form.p_category").value = ['schoolfee'] … … 1240 1241 # The same payment (with same p_item, p_session and p_category) 1241 1242 # can be initialized a second time if the former ticket is not yet paid. 1242 self.browser.open(self.payments_ student_path)1243 self.browser.open(self.payments_path) 1243 1244 self.browser.getControl("Add online payment ticket").click() 1244 1245 self.browser.getControl(name="form.p_category").value = ['schoolfee'] … … 1261 1262 # Now the first ticket is paid and no more ticket of same type 1262 1263 # (with same p_item, p_session and p_category) can be added 1263 self.browser.open(self.payments_ student_path)1264 self.browser.open(self.payments_path) 1264 1265 self.browser.getControl("Add online payment ticket").click() 1265 1266 self.browser.getControl(name="form.p_category").value = ['schoolfee'] … … 1276 1277 1277 1278 # Managers can remove online school fee payment tickets 1278 self.browser.open(self.payments_ student_path)1279 self.browser.open(self.payments_path) 1279 1280 self.browser.getControl("Remove selected").click() 1280 1281 self.assertMatches('...No payment selected...', self.browser.contents) … … 1286 1287 1287 1288 # Managers can add online clearance payment tickets 1288 self.browser.open(self.payments_ student_path + '/addop')1289 self.browser.open(self.payments_path + '/addop') 1289 1290 self.browser.getControl(name="form.p_category").value = ['clearance'] 1290 1291 self.browser.getControl("Create ticket").click() … … 1320 1321 1321 1322 # Students can add online clearance payment tickets 1322 self.browser.open(self.payments_ student_path + '/addop')1323 self.browser.open(self.payments_path + '/addop') 1323 1324 self.browser.getControl(name="form.p_category").value = ['clearance'] 1324 1325 self.browser.getControl("Create ticket").click() … … 1375 1376 1376 1377 # Students can add online school fee payment tickets 1377 self.browser.open(self.payments_ student_path)1378 self.browser.open(self.payments_path) 1378 1379 self.browser.getControl("Add online payment ticket").click() 1379 1380 self.browser.getControl(name="form.p_category").value = ['schoolfee'] … … 1395 1396 # Students can remove only online payment tickets which have 1396 1397 # not received a valid callback 1397 self.browser.open(self.payments_ student_path)1398 self.browser.open(self.payments_path) 1398 1399 self.assertRaises( 1399 1400 LookupError, self.browser.getControl, name='val_id') 1400 self.browser.open(self.payments_ student_path + '/addop')1401 self.browser.open(self.payments_path + '/addop') 1401 1402 self.browser.getControl(name="form.p_category").value = ['gown'] 1402 1403 self.browser.getControl("Create ticket").click() 1403 self.browser.open(self.payments_ student_path)1404 self.browser.open(self.payments_path) 1404 1405 ctrl = self.browser.getControl(name='val_id') 1405 1406 value = ctrl.options[0] … … 1411 1412 IWorkflowInfo(self.student).fireTransition('request_clearance') 1412 1413 IWorkflowInfo(self.student).fireTransition('clear') 1413 self.browser.open(self.studycourse_ student_path)1414 self.browser.open(self.studycourse_path) 1414 1415 self.browser.getLink('Start course registration').click() 1415 1416 pin = self.app['accesscodes']['SFE-0'].keys()[0] … … 1428 1429 # callback view (see test_manage_payments) 1429 1430 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 1430 self.browser.open(self.payments_ student_path)1431 self.browser.open(self.payments_path) 1431 1432 self.browser.getControl("Add online payment ticket").click() 1432 1433 self.browser.getControl(name="form.p_category").value = ['bed_allocation'] … … 1452 1453 sfeseries, sfenumber = parts 1453 1454 # Managers can use HOS code and book a bed space with it 1454 self.browser.open(self.acco_ student_path)1455 self.browser.open(self.acco_path) 1455 1456 self.browser.getLink("Book accommodation").click() 1456 1457 self.assertMatches('...You are in the wrong...', … … 1481 1482 self.browser.contents) 1482 1483 # The bed ticket displays the data correctly 1483 self.browser.open(self.acco_ student_path + '/2004')1484 self.browser.open(self.acco_path + '/2004') 1484 1485 self.assertMatches('...Hall 1, Block A, Room 101, Bed A...', 1485 1486 self.browser.contents) … … 1529 1530 self.assertMatches(old_owner, self.student_id) 1530 1531 bed2.owner = self.student_id 1531 self.browser.open(self.acco_ student_path + '/2004')1532 self.browser.open(self.acco_path + '/2004') 1532 1533 self.assertMatches( 1533 1534 "...booking cancelled...", self.browser.contents) … … 1545 1546 "... Hall 1, Block A, Room 101, Bed B...", self.browser.contents) 1546 1547 # Managers can delete bed tickets 1547 self.browser.open(self.acco_ student_path)1548 self.browser.open(self.acco_path) 1548 1549 ctrl = self.browser.getControl(name='val_id') 1549 1550 value = ctrl.options[0] … … 1582 1583 1583 1584 # Students can use HOS code and book a bed space with it 1584 self.browser.open(self.acco_ student_path)1585 self.browser.open(self.acco_path) 1585 1586 self.browser.getLink("Book accommodation").click() 1586 1587 self.assertMatches('...You are in the wrong...', … … 1617 1618 1618 1619 # The bed ticket displays the data correctly 1619 self.browser.open(self.acco_ student_path + '/2004')1620 self.browser.open(self.acco_path + '/2004') 1620 1621 self.assertMatches('...Hall 1, Block A, Room 101, Bed A...', 1621 1622 self.browser.contents) … … 1631 1632 # Students can't relocate themselves 1632 1633 self.assertFalse('Relocate' in self.browser.contents) 1633 relocate_path = self.acco_ student_path + '/2004/relocate'1634 relocate_path = self.acco_path + '/2004/relocate' 1634 1635 self.assertRaises( 1635 1636 Unauthorized, self.browser.open, relocate_path) 1636 1637 1637 1638 # Students can't the Remove button and check boxes 1638 self.browser.open(self.acco_ student_path)1639 self.browser.open(self.acco_path) 1639 1640 self.assertFalse('Remove' in self.browser.contents) 1640 1641 self.assertFalse('val_id' in self.browser.contents) … … 1664 1665 results = cat.searchResults(student_id=(None, None)) 1665 1666 self.assertEqual(len(results),1) 1667 1668 def test_change_current_mode(self): 1669 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 1670 self.browser.open(self.clearance_path) 1671 self.assertFalse('Employer' in self.browser.contents) 1672 self.browser.open(self.manage_clearance_path) 1673 self.assertFalse('Employer' in self.browser.contents) 1674 self.student.clearance_locked = False 1675 self.browser.open(self.edit_clearance_path) 1676 self.assertFalse('Employer' in self.browser.contents) 1677 # Now we change the study mode of the certificate and a different 1678 # interface is used by clearance views 1679 self.certificate.study_mode = 'pg_ft' 1680 self.browser.open(self.clearance_path) 1681 self.assertTrue('Employer' in self.browser.contents) 1682 self.browser.open(self.manage_clearance_path) 1683 self.assertTrue('Employer' in self.browser.contents) 1684 self.browser.open(self.edit_clearance_path) 1685 self.assertTrue('Employer' in self.browser.contents) -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r7973 r7993 66 66 self.assertEqual( 67 67 result, 68 'adm_code,clearance_locked,clr_code,date_of_birth,email, '68 'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,' 69 69 'firstname,lastname,matric_number,middlename,nationality,' 70 70 'perm_address,phone,reg_number,sex,student_id\r\n' 71 71 72 'my adm code,0,my clr code,1981-02-04#,anna@sample.com, Anna,'72 'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,Anna,' 73 73 'Tester,M123456,M.,nigeria,"Studentroad 21\nLagos 123456\n",' 74 74 '+234-123-12345,123456,f,A111111\r\n' … … 85 85 self.assertEqual( 86 86 result, 87 'adm_code,clearance_locked,clr_code,date_of_birth,email, '87 'adm_code,clearance_locked,clr_code,date_of_birth,email,employer,' 88 88 'firstname,lastname,matric_number,middlename,nationality,' 89 89 'perm_address,phone,reg_number,sex,student_id\r\n' 90 90 91 'my adm code,0,my clr code,1981-02-04#,anna@sample.com, Anna,'91 'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,Anna,' 92 92 'Tester,M123456,M.,nigeria,"Studentroad 21\nLagos 123456\n",' 93 93 '+234-123-12345,123456,f,A111111\r\n'
Note: See TracChangeset for help on using the changeset viewer.