- Timestamp:
- 12 Jul 2015, 17:19:11 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r13108 r13164 1479 1479 self.init_clearance_officer() 1480 1480 self.assertMatches('...You logged in...', self.browser.contents) 1481 # CO is landing on index page 1481 # CO is landing on index page. 1482 1482 self.assertEqual(self.browser.url, 'http://localhost/app/index') 1483 1483 # CO can see his roles … … 1489 1489 self.assertFalse('Clearance Officer' in self.browser.contents) 1490 1490 # ... because we forgot to notify the department that the local role 1491 # has changed 1491 # has changed. 1492 1492 notify(LocalRoleSetEvent( 1493 1493 self.department, 'waeup.local.ClearanceOfficer', 'mrclear', … … 1502 1502 self.assertEqual(self.browser.headers['Status'], '200 Ok') 1503 1503 self.assertEqual(self.browser.url, self.clearance_path) 1504 # ... but not other students 1504 # ... but not other students. 1505 1505 self.assertRaises( 1506 1506 Unauthorized, self.browser.open, self.other_student_path) 1507 # Clearance is disabled for this session 1507 # Clearance is disabled for this session. 1508 1508 self.browser.open(self.clearance_path) 1509 1509 self.assertFalse('Clear student' in self.browser.contents) … … 1512 1512 in self.browser.contents) 1513 1513 self.app['configuration']['2004'].clearance_enabled = True 1514 # Only in state clearance requested the CO does see the 'Clear' button 1514 # Only in state clearance requested the CO does see the 'Clear' button. 1515 1515 self.browser.open(self.clearance_path) 1516 1516 self.assertFalse('Clear student' in self.browser.contents) … … 1532 1532 self.assertEqual( 1533 1533 self.browser.url, self.student_path + '/reject_clearance') 1534 # Type comment why 1534 # Type comment why. 1535 1535 self.browser.getControl(name="form.officer_comment").value = ( 1536 1536 'Dear Student,\n' … … 1541 1541 'contactstudent?body=Dear+Student%2C%0AYou+did+not+fill+properly.' 1542 1542 '&subject=Clearance+has+been+annulled.') 1543 # CO does now see the prefilled contact form and can send a message 1543 # CO does now see the prefilled contact form and can send a message. 1544 1544 self.assertEqual(self.browser.url, url) 1545 1545 self.assertTrue('clearance started' in self.browser.contents) … … 1554 1554 self.assertEqual(self.student.officer_comment, 1555 1555 u'Dear Student,\nYou did not fill properly.') 1556 # ... and logged 1556 # ... and logged. 1557 1557 logfile = os.path.join( 1558 1558 self.app['datacenter'].storage, 'logs', 'students.log') … … 1573 1573 self.assertTrue('clearance started' in self.browser.contents) 1574 1574 # The CO can't clear students if not in state 1575 # clearance requested 1575 # clearance requested. 1576 1576 self.browser.open(self.student_path + '/clear') 1577 1577 self.assertTrue('Student is in wrong state' … … 1580 1580 self.browser.open('http://localhost/app/users/mrclear/my_roles') 1581 1581 self.browser.getLink("http://localhost/app/faculties/fac1/dep1").click() 1582 # ... and view the list of students 1582 # ... and view the list of students. 1583 1583 self.browser.getLink("Show students").click() 1584 1584 self.browser.getControl(name="session").value = ['2004'] … … 1590 1590 self.browser.getControl("Show").click() 1591 1591 self.assertTrue(self.student_id in self.browser.contents) 1592 # The comment is indicated by 'yes' 1592 # The comment is indicated by 'yes'. 1593 1593 self.assertTrue('<td><span>yes</span></td>' in self.browser.contents) 1594 1594 # Check if the enquiries form is not pre-filled with officer_comment 1595 # (regression test) 1595 # (regression test). 1596 1596 self.browser.getLink("Logout").click() 1597 1597 self.browser.open('http://localhost/app/enquiries') … … 1640 1640 prmlocal.assignRoleToPrincipal('waeup.local.CourseAdviser100', 'mrsadvise') 1641 1641 IWorkflowState(self.student).setState('school fee paid') 1642 # Login as course adviser 1642 # Login as course adviser. 1643 1643 self.browser.open(self.login_path) 1644 1644 self.browser.getControl(name="form.login").value = 'mrsadvise' … … 1646 1646 self.browser.getControl("Login").click() 1647 1647 self.assertMatches('...You logged in...', self.browser.contents) 1648 # CO can see his roles 1648 # CO can see his roles. 1649 1649 self.browser.getLink("My Roles").click() 1650 1650 self.assertMatches( … … 1654 1654 self.assertFalse('Course Adviser' in self.browser.contents) 1655 1655 # ... because we forgot to notify the certificate that the local role 1656 # has changed 1656 # has changed. 1657 1657 notify(LocalRoleSetEvent( 1658 1658 cert, 'waeup.local.CourseAdviser100', 'mrsadvise', granted=True)) … … 1666 1666 self.assertEqual(self.browser.headers['Status'], '200 Ok') 1667 1667 self.assertEqual(self.browser.url, self.student_path) 1668 # ... but not other students 1668 # ... but not other students. 1669 1669 other_student = Student() 1670 1670 other_student.firstname = u'Dep2' … … 1675 1675 self.assertRaises( 1676 1676 Unauthorized, self.browser.open, other_student_path) 1677 # We add study level 110 to the student's studycourse 1677 # We add study level 110 to the student's studycourse. 1678 1678 studylevel = StudentStudyLevel() 1679 1679 studylevel.level = 110 … … 1681 1681 cert,studylevel) 1682 1682 L110_student_path = self.studycourse_path + '/110' 1683 # The CA can neither see the Validate nor the Edit button 1683 # The CA can neither see the Validate nor the Edit button. 1684 1684 self.browser.open(L110_student_path) 1685 1685 self.assertFalse('Validate courses' in self.browser.contents) … … 1692 1692 # corresponds with the name of the study level object 1693 1693 # the 100L CA does see the 'Validate' button but not 1694 # the edit button 1694 # the edit button. 1695 1695 self.student['studycourse'].current_level = 110 1696 1696 self.browser.open(L110_student_path) 1697 1697 self.assertFalse('Edit' in self.browser.contents) 1698 1698 self.assertTrue('Validate courses' in self.browser.contents) 1699 # But a 100L CA does not see the button at other levels 1699 # But a 100L CA does not see the button at other levels. 1700 1700 studylevel2 = StudentStudyLevel() 1701 1701 studylevel2.level = 200 … … 1731 1731 in self.browser.contents) 1732 1732 self.assertTrue('school fee paid' in self.browser.contents) 1733 # CA does now see the contact form and can send a message 1733 # CA does now see the contact form and can send a message. 1734 1734 self.browser.getControl(name="form.subject").value = 'Important subject' 1735 1735 self.browser.getControl(name="form.body").value = 'Course list rejected' … … 1737 1737 self.assertTrue('Your message has been sent' in self.browser.contents) 1738 1738 # The CA does now see the Edit button and can edit 1739 # current study level 1739 # current study level. 1740 1740 self.browser.open(L110_student_path) 1741 1741 self.browser.getLink("Edit").click() … … 1743 1743 in self.browser.contents) 1744 1744 # The CA can't validate courses if not in state 1745 # courses registered 1745 # courses registered. 1746 1746 self.browser.open(L110_student_path + '/validate_courses') 1747 1747 self.assertTrue('Student is in the wrong state' 1748 1748 in self.browser.contents) 1749 # The CA can go to his certificate through the my_roles page 1749 # The CA can go to his certificate through the my_roles page ... 1750 1750 self.browser.open('http://localhost/app/users/mrsadvise/my_roles') 1751 1751 self.browser.getLink( 1752 1752 "http://localhost/app/faculties/fac1/dep1/certificates/CERT1").click() 1753 # and view the list of students1753 # ... and view the list of students. 1754 1754 self.browser.getLink("Show students").click() 1755 1755 self.browser.getControl(name="session").value = ['2004'] … … 1762 1762 self.app['users']['mrslecturer'].email = 'mrslecturer@foo.ng' 1763 1763 self.app['users']['mrslecturer'].title = u'Mercedes Benz' 1764 # Assign local Lecturer role for a certificate 1764 # Assign local Lecturer role for a certificate. 1765 1765 course = self.app['faculties']['fac1']['dep1'].courses['COURSE1'] 1766 1766 prmlocal = IPrincipalRoleManager(course) 1767 1767 prmlocal.assignRoleToPrincipal('waeup.local.Lecturer', 'mrslecturer') 1768 # Login as lecturer 1768 # Login as lecturer. 1769 1769 self.browser.open(self.login_path) 1770 1770 self.browser.getControl(name="form.login").value = 'mrslecturer' … … 1772 1772 self.browser.getControl("Login").click() 1773 1773 self.assertMatches('...You logged in...', self.browser.contents) 1774 # CO can see her roles 1774 # CO can see her roles. 1775 1775 self.browser.getLink("My Roles").click() 1776 1776 self.assertMatches( … … 1780 1780 self.assertFalse('Lecturer' in self.browser.contents) 1781 1781 # ... because we forgot to notify the course that the local role 1782 # has changed 1782 # has changed. 1783 1783 notify(LocalRoleSetEvent( 1784 1784 course, 'waeup.local.Lecturer', 'mrslecturer', granted=True)) … … 1788 1788 '...<a href="http://localhost/app/faculties/fac1/dep1/courses/COURSE1">...', 1789 1789 self.browser.contents) 1790 # The lecturer can go to her course 1790 # The lecturer can go to her course ... 1791 1791 self.browser.getLink( 1792 1792 "http://localhost/app/faculties/fac1/dep1/courses/COURSE1").click() 1793 # and view the list of students1793 # ... and view the list of students 1794 1794 self.browser.getLink("Show students").click() 1795 1795 self.browser.getControl(name="session").value = ['2004'] … … 1797 1797 self.browser.getControl("Show").click() 1798 1798 self.assertTrue('No student found.' in self.browser.contents) 1799 # No student in course so far 1799 # No student in course so far. 1800 1800 self.assertFalse(self.student_id in self.browser.contents) 1801 1801 studylevel = createObject(u'waeup.StudentStudyLevel') … … 1820 1820 self.assertRaises( 1821 1821 Unauthorized, self.browser.open, course_ticket_path) 1822 # Course results can be batch edited via the edit_courses view 1822 # Course results can be batch edited via the edit_courses view. 1823 1823 self.app['faculties']['fac1']['dep1'].score_editing_disabled = True 1824 1824 self.browser.open("http://localhost/app/faculties/fac1/dep1/courses/COURSE1") … … 1834 1834 in self.browser.contents) 1835 1835 IWorkflowState(self.student).setState('courses validated') 1836 # Student must be in state 'courses validated' 1836 # Student must be in state 'courses validated'. 1837 1837 self.browser.open( 1838 1838 "http://localhost/app/faculties/fac1/dep1/courses/COURSE1/edit_scores") … … 1842 1842 self.browser.getControl(name="scores", index=0).value = '55' 1843 1843 self.browser.getControl("Update scores").click() 1844 # New score has been set 1844 # New score has been set. 1845 1845 self.assertEqual( 1846 1846 self.student['studycourse']['100']['COURSE1'].score, 55) 1847 # Score editing has been logged 1847 # Score editing has been logged. 1848 1848 logfile = os.path.join( 1849 1849 self.app['datacenter'].storage, 'logs', 'students.log') … … 1851 1851 self.assertTrue('mrslecturer - students.browser.EditScoresPage - ' 1852 1852 'K1000000 100/COURSE1 score updated (55)' in logcontent) 1853 # Non-integer scores won't be accepted 1853 # Non-integer scores won't be accepted. 1854 1854 self.browser.open( 1855 1855 "http://localhost/app/faculties/fac1/dep1/courses/COURSE1/edit_scores") … … 1859 1859 self.assertTrue('Error: Score(s) of Anna Tester have not be updated' 1860 1860 in self.browser.contents) 1861 # Scores can be removed 1861 # Scores can be removed. 1862 1862 self.browser.open( 1863 1863 "http://localhost/app/faculties/fac1/dep1/courses/COURSE1/edit_scores") … … 2985 2985 self.browser.getControl("Login").click() 2986 2986 # Students can add online booking fee payment tickets and open the 2987 # callback view (see test_manage_payments) 2987 # callback view (see test_manage_payments). 2988 2988 self.browser.getLink("Payments").click() 2989 2989 self.browser.getLink("Add current session payment ticket").click() … … 2994 2994 self.browser.getLink(value).click() 2995 2995 self.browser.open(self.browser.url + '/fake_approve') 2996 # The new HOS-0 pin has been created 2996 # The new HOS-0 pin has been created. 2997 2997 self.assertEqual(len(self.app['accesscodes']['HOS-0']),1) 2998 2998 pin = self.app['accesscodes']['HOS-0'].keys()[0] … … 3029 3029 self.assertMatches('...You are not the owner of this access code...', 3030 3030 self.browser.contents) 3031 # The bed remains empty 3031 # The bed remains empty. 3032 3032 bed = self.app['hostels']['hall-1']['hall-1_A_101_A'] 3033 3033 self.assertTrue(bed.owner == NOT_OCCUPIED) … … 3038 3038 self.assertMatches('...Hall 1, Block A, Room 101, Bed A...', 3039 3039 self.browser.contents) 3040 # Bed has been allocated 3040 # Bed has been allocated. 3041 3041 self.assertTrue(bed.owner == self.student_id) 3042 # BedTicketAddPage is now blocked 3042 # BedTicketAddPage is now blocked. 3043 3043 self.browser.getLink("Book accommodation").click() 3044 3044 self.assertMatches('...You already booked a bed space...', 3045 3045 self.browser.contents) 3046 # The bed ticket displays the data correctly 3046 # The bed ticket displays the data correctly. 3047 3047 self.browser.open(self.acco_path + '/2004') 3048 3048 self.assertMatches('...Hall 1, Block A, Room 101, Bed A...', … … 3051 3051 self.assertMatches('...regular_male_fr...', self.browser.contents) 3052 3052 self.assertMatches('...%s...' % pin, self.browser.contents) 3053 # Students can open the pdf slip 3053 # Students can open the pdf slip. 3054 3054 self.browser.open(self.browser.url + '/bed_allocation_slip.pdf') 3055 3055 self.assertEqual(self.browser.headers['Status'], '200 Ok') 3056 3056 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 3057 # Students can't relocate themselves 3057 # Students can't relocate themselves. 3058 3058 self.assertFalse('Relocate' in self.browser.contents) 3059 3059 relocate_path = self.acco_path + '/2004/relocate' 3060 3060 self.assertRaises( 3061 3061 Unauthorized, self.browser.open, relocate_path) 3062 # Students can't the Remove button and check boxes3062 # Students can't see the Remove button and check boxes. 3063 3063 self.browser.open(self.acco_path) 3064 3064 self.assertFalse('Remove' in self.browser.contents) 3065 3065 self.assertFalse('val_id' in self.browser.contents) 3066 # Students can pay maintenance fee now 3066 # Students can pay maintenance fee now. 3067 3067 self.browser.open(self.payments_path) 3068 3068 self.browser.open(self.payments_path + '/addop') … … 3073 3073 ctrl = self.browser.getControl(name='val_id') 3074 3074 value = ctrl.options[0] 3075 # Maintennace fee is taken from the hostel object 3075 # Maintennace fee is taken from the hostel object. 3076 3076 self.assertEqual(self.student['payments'][value].amount_auth, 876.0) 3077 3077 # If the hostel's maintenance fee isn't set, the fee is
Note: See TracChangeset for help on using the changeset viewer.