Changeset 15277 for main/waeup.kofa/trunk/src/waeup/kofa/students/tests
- Timestamp:
- 19 Dec 2018, 22:50:36 (6 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
r15250 r15277 4181 4181 self.assertEqual(len(self.app['datacenter'].running_exports), 0) 4182 4182 4183 def test_export_accommodation_officers(self): 4184 # Create bursary officer 4185 self.app['users'].addUser('mracco', 'mraccosecret') 4186 self.app['users']['mracco'].email = 'mracco@foo.ng' 4187 self.app['users']['mracco'].title = 'Carlo Pitter' 4188 prmglobal = IPrincipalRoleManager(self.app) 4189 prmglobal.assignRoleToPrincipal('waeup.AccommodationOfficer', 'mracco') 4190 # Login as bursary officer 4191 self.browser.open(self.login_path) 4192 self.browser.getControl(name="form.login").value = 'mracco' 4193 self.browser.getControl(name="form.password").value = 'mraccosecret' 4194 self.browser.getControl("Login").click() 4195 self.assertMatches('...You logged in...', self.browser.contents) 4196 self.browser.getLink("Academics").click() 4197 self.browser.getLink("Export student data").click() 4198 self.browser.getControl("Configure new export").click() 4199 # accommodationpayments and beds exporters are available 4200 # not only at facultiescontainer level ... 4201 self.assertFalse('<option value="students">' in self.browser.contents) 4202 self.assertTrue('<option value="accommodationpayments">' 4203 in self.browser.contents) 4204 self.assertTrue('<option value="bedtickets">' in self.browser.contents) 4205 self.browser.getControl( 4206 name="exporter").value = ['accommodationpayments'] 4207 self.browser.getControl(name="session").value = ['2004'] 4208 self.browser.getControl(name="level").value = ['100'] 4209 self.browser.getControl("Create CSV file").click() 4210 self.assertTrue('Export started' in self.browser.contents) 4211 # ... but also at other levels 4212 self.browser.open('http://localhost/app/faculties/fac1/dep1') 4213 self.browser.getLink("Export student data").click() 4214 self.browser.getControl("Configure new export").click() 4215 self.assertFalse('<option value="students">' in self.browser.contents) 4216 self.assertTrue('<option value="accommodationpayments">' 4217 in self.browser.contents) 4218 self.assertTrue('<option value="bedtickets">' in self.browser.contents) 4219 # Thew job can be discarded 4220 self.assertEqual(len(self.app['datacenter'].running_exports), 1) 4221 self.wait_for_export_job_completed() 4222 self.browser.open('http://localhost/app/faculties/exports') 4223 self.browser.getControl("Discard").click() 4224 self.assertEqual(len(self.app['datacenter'].running_exports), 0) 4225 4183 4226 4184 4227 UPLOAD_CSV_TEMPLATE = ( -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r15203 r15277 33 33 ComboCardDataExporter, DataForBursaryExporter, 34 34 StudentUnpaidPaymentExporter, SessionPaymentsOverviewExporter, 35 get_students,)35 AccommodationPaymentsExporter, get_students,) 36 36 from waeup.kofa.students.accommodation import BedTicket 37 37 from waeup.kofa.students.interfaces import ICSVStudentExporter … … 1043 1043 'Anna,M.,Tester,created,2012,2010,ug_ft,NA,NA,CERT1\r\n' 1044 1044 % (curr_year-6, curr_year-6, curr_year-6) 1045 ) 1046 return 1047 1048 class AccommodationPaymentsExporterTest(StudentImportExportSetup): 1049 1050 layer = FunctionalLayer 1051 1052 def setUp(self): 1053 super(AccommodationPaymentsExporterTest, self).setUp() 1054 self.setup_for_export() 1055 return 1056 1057 def test_export_all(self): 1058 self.setup_student(self.student) 1059 # add accommodation payments 1060 payment = StudentOnlinePayment() 1061 payment.creation_date = datetime.datetime(curr_year-6, 4, 1, 13, 12, 1) 1062 payment.p_id = 'id1' 1063 payment.p_category = u'bed_allocation' 1064 payment.p_state = 'paid' 1065 payment.ac = u'abc' 1066 payment.p_item = u'xyz' 1067 payment.p_level = 100 1068 payment.p_session = curr_year - 6 1069 payment.payment_date = datetime.datetime(curr_year-6, 4, 1, 14, 12, 1) 1070 payment.amount_auth = 12.12 1071 payment.r_amount_approved = 12.12 1072 payment.r_code = u'cde' 1073 payment2 = StudentOnlinePayment() 1074 payment2.creation_date = datetime.datetime(curr_year-6, 4, 1, 13, 12, 1) 1075 payment2.p_id = 'id2' 1076 payment2.p_category = u'hostel_maintenance' 1077 payment2.p_state = 'paid' 1078 payment2.ac = u'abc' 1079 payment2.p_item = u'xyz' 1080 payment2.p_level = 100 1081 payment2.p_session = curr_year - 6 1082 payment2.payment_date = datetime.datetime(curr_year-6, 4, 1, 14, 12, 1) 1083 payment2.amount_auth = 12.12 1084 payment2.r_amount_approved = 12.12 1085 payment2.r_code = u'cde' 1086 # XXX: there is no addPayment method to give predictable names 1087 self.payment = self.student['payments']['id1'] = payment 1088 self.payment = self.student['payments']['id2'] = payment2 1089 exporter = AccommodationPaymentsExporter() 1090 exporter.export_all(self.app, self.outfile) 1091 result = open(self.outfile, 'rb').read() 1092 # only accommodation payments are exported 1093 self.assertEqual( 1094 result, 1095 'ac,amount_auth,creation_date,p_category,p_current,p_id,p_item,' 1096 'p_level,p_session,p_state,payment_date,r_amount_approved,r_code,' 1097 'r_desc,student_id,matric_number,reg_number,firstname,middlename,lastname,' 1098 'state,current_session,entry_session,entry_mode,faccode,depcode,certcode\r\n' 1099 'abc,12.12,%s-04-01 13:12:01#,bed_allocation,1,id1,xyz,100,%s,' 1100 'paid,%s-04-01 14:12:01#,12.12,cde,,A111111,234,123,' 1101 'Anna,M.,Tester,created,2012,2010,ug_ft,NA,NA,CERT1\r\n' 1102 'abc,12.12,%s-04-01 13:12:01#,hostel_maintenance,1,id2,xyz,100,%s,' 1103 'paid,%s-04-01 14:12:01#,12.12,cde,,A111111,234,123,' 1104 'Anna,M.,Tester,created,2012,2010,ug_ft,NA,NA,CERT1\r\n' 1105 % (curr_year-6, curr_year-6, curr_year-6, 1106 curr_year-6, curr_year-6, curr_year-6) 1045 1107 ) 1046 1108 return
Note: See TracChangeset for help on using the changeset viewer.