Changeset 7005 for main/waeup.sirp/trunk/src/waeup/sirp/students
- Timestamp:
- 6 Nov 2011, 08:54:08 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r6946 r7005 39 39 from waeup.sirp.university.department import Department 40 40 from waeup.sirp.interfaces import IUserAccount 41 from waeup.sirp.hostels.hostel import Hostel, Bed, NOT_OCCUPIED 41 42 42 43 PH_LEN = 2059 # Length of placeholder file … … 87 88 student.reg_number = u'123' 88 89 student.matric_number = u'234' 90 student.sex = u'm' 89 91 self.app['students'].addStudent(student) 90 92 self.student_id = student.student_id … … 105 107 self.edit_clearance_student_path = self.student_path + '/edit_clearance' 106 108 self.edit_personal_student_path = self.student_path + '/edit_personal' 107 108 109 self.studycourse_student_path = self.student_path + '/studycourse' 109 110 self.payments_student_path = self.student_path + '/payments' 110 self.acco mmodation_student_path = self.student_path + '/accommodation'111 self.acco_student_path = self.student_path + '/accommodation' 111 112 self.history_student_path = self.student_path + '/history' 112 113 … … 151 152 self.course, level=100) 152 153 154 # Configure university 155 self.app['configuration'].accommodation_states = ['admitted'] 156 self.app['configuration'].accommodation_session = 2004 157 configuration = SessionConfiguration() 158 configuration.academic_session = 2004 159 configuration.fee_1 = 20000 160 configuration.boocking_fee = 500 161 self.app['configuration'].addSessionConfiguration(configuration) 162 163 # Create a hostel with bed 164 hostel = Hostel() 165 hostel.hostel_id = u'hall-1' 166 hostel.hostel_name = u'Hall 1' 167 self.app['hostels'].addHostel(hostel) 168 bed = Bed() 169 bed.bed_id = u'hall-1_A_101_A' 170 bed.bed_number = 1 171 bed.owner = NOT_OCCUPIED 172 bed.bed_type = u'regular_male_fr' 173 self.app['hostels'][hostel.hostel_id].addBed(bed) 174 153 175 # Set study course attributes of test student 154 176 self.student['studycourse'].certificate = self.certificate 155 177 self.student['studycourse'].current_session = 2004 178 self.student['studycourse'].entry_session = 2004 156 179 self.student['studycourse'].current_verdict = 'A' 157 180 self.student['studycourse'].current_level = 100 … … 308 331 self.browser.getLink("Accommodation").click() 309 332 self.assertEqual(self.browser.headers['Status'], '200 Ok') 310 self.assertEqual(self.browser.url, self.acco mmodation_student_path)333 self.assertEqual(self.browser.url, self.acco_student_path) 311 334 self.browser.open(self.student_path) 312 335 self.browser.getLink("History").click() … … 653 676 654 677 def test_manage_payments(self): 655 # Set up SessionConfiguration object656 configuration = SessionConfiguration()657 configuration.academic_session = 2004658 configuration.fee_1 = 20000659 self.app['configuration'].addSessionConfiguration(configuration)660 661 678 # Managers can add online school fee payment tickets 662 679 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') … … 726 743 727 744 728 729 745 def test_student_payments(self): 730 746 # Set up SessionConfiguration object 731 configuration = SessionConfiguration()732 configuration.academic_session = 2004733 configuration.fee_1 = 20000734 self.app['configuration'].addSessionConfiguration(configuration)735 747 self.browser.open(self.login_path) 736 748 self.browser.getControl(name="form.login").value = self.student_id … … 822 834 self.browser.contents) 823 835 self.assertTrue(self.student.state,'school fee paid') 836 837 def test_manage_accommodation(self): 838 # Managers can add online booking fee payment tickets and open the 839 # callback view (see test_manage_payments) 840 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 841 self.browser.open(self.payments_student_path) 842 self.browser.getControl("Add online payment ticket").click() 843 self.browser.getControl(name="form.p_category").value = ['bed_allocation'] 844 self.browser.getControl("Create ticket").click() 845 ctrl = self.browser.getControl(name='val_id') 846 value = ctrl.options[0] 847 self.browser.getLink(value).click() 848 self.browser.open(self.browser.url + '/callback') 849 # The new HOS-0 pin has been created 850 self.assertEqual(len(self.app['accesscodes']['HOS-0']),1) 851 pin = self.app['accesscodes']['HOS-0'].keys()[0] 852 ac = self.app['accesscodes']['HOS-0'][pin] 853 ac.owner = self.student_id 854 parts = pin.split('-')[1:] 855 sfeseries, sfenumber = parts 856 # Managers can use HOS code and book a bed space with it 857 self.browser.open(self.acco_student_path) 858 self.browser.getControl("Add bed ticket").click() 859 self.assertMatches('...Wrong state...', 860 self.browser.contents) 861 IWorkflowInfo(self.student).fireTransition('admit') 862 self.browser.getControl("Add bed ticket").click() 863 self.assertMatches('...Activation Code:...', 864 self.browser.contents) 865 self.browser.getControl(name="ac_series").value = sfeseries 866 self.browser.getControl(name="ac_number").value = sfenumber 867 self.browser.getControl("Create bed ticket").click() 868 self.assertMatches('...Hall 1, Block A, Room 101, Bed A...', 869 self.browser.contents) 870 # Bed has been allocated 871 bed = self.app['hostels']['hall-1']['hall-1_A_101_A'] 872 self.assertTrue(bed.owner,self.student_id) 873 # BedTicketAddPage is now blocked 874 self.browser.getControl("Add bed ticket").click() 875 self.assertMatches('...Ticket for 2004 already created...', 876 self.browser.contents) 877 # The bed ticket displays the data correctly 878 self.browser.open(self.acco_student_path + '/2004') 879 self.assertMatches('...Hall 1, Block A, Room 101, Bed A...', 880 self.browser.contents) 881 self.assertMatches('...2004/2005...', self.browser.contents) 882 self.assertMatches('...regular_male_fr...', self.browser.contents) 883 self.assertMatches('...%s...' % pin, self.browser.contents) 884 # Managers cab delete bed tickets 885 self.browser.open(self.acco_student_path) 886 ctrl = self.browser.getControl(name='val_id') 887 value = ctrl.options[0] 888 ctrl.getControl(value=value).selected = True 889 self.browser.getControl("Remove selected", index=0).click() 890 self.assertTrue('Successfully removed' in self.browser.contents) 891 # Due to an event handler also the bed has been released properly 892 bed = self.app['hostels']['hall-1']['hall-1_A_101_A'] 893 self.assertTrue(bed.owner == NOT_OCCUPIED) 894 895 def test_student_accommodation(self): 896 pass
Note: See TracChangeset for help on using the changeset viewer.