Changeset 8753 for main/waeup.aaue/trunk/src/waeup/aaue/students/tests
- Timestamp:
- 18 Jun 2012, 17:00:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py
r8723 r8753 194 194 self.browser.getControl("Add online payment ticket").click() 195 195 self.browser.getControl("Create ticket").click() 196 self.assertMatches('...Wrong state...', 197 self.browser.contents) 198 IWorkflowState(self.student).setState('cleared') 199 self.browser.open(self.payments_path + '/addop') 200 self.browser.getControl("Create ticket").click() 196 201 self.assertMatches('...Amount could not be determined...', 197 202 self.browser.contents) 198 IWorkflowState(self.student).setState('cleared') 199 self.browser.open(self.payments_path + '/addop') 203 204 self.app['configuration']['2004'].school_fee_base = 6666.0 205 206 self.browser.getControl("Add online payment ticket").click() 200 207 self.browser.getControl("Create ticket").click() 201 208 self.assertMatches('...ticket created...', … … 217 224 self.assertMatches('...This type of payment has already been made...', 218 225 self.browser.contents) 226 self.browser.open(self.payments_path + '/addop') 227 # Also the other payments can be made 228 self.browser.getControl(name="form.p_category").value = ['gown'] 229 self.browser.getControl("Create ticket").click() 230 self.assertMatches('...ticket created...', 231 self.browser.contents) 232 self.browser.open(self.payments_path + '/addop') 233 self.browser.getControl(name="form.p_category").value = ['transfer'] 234 self.browser.getControl("Create ticket").click() 235 self.assertMatches('...ticket created...', 236 self.browser.contents) 237 self.browser.open(self.payments_path + '/addop') 238 self.browser.getControl( 239 name="form.p_category").value = ['bed_allocation'] 240 self.browser.getControl("Create ticket").click() 241 self.assertMatches('...ticket created...', 242 self.browser.contents) 243 self.browser.open(self.payments_path + '/addop') 244 self.browser.getControl( 245 name="form.p_category").value = ['hostel_maintenance'] 246 self.browser.getControl("Create ticket").click() 247 self.assertMatches('...ticket created...', 248 self.browser.contents) 249 self.browser.open(self.payments_path + '/addop') 250 self.browser.getControl(name="form.p_category").value = ['clearance'] 251 self.browser.getControl("Create ticket").click() 252 self.assertMatches('...ticket created...', 253 self.browser.contents) 219 254 # Remove all payments so that we can add a school fee payment again 220 255 keys = [i for i in self.student['payments'].keys()] … … 222 257 del self.student['payments'][payment] 223 258 self.browser.open(self.payments_path + '/addop') 224 self.browser.getControl("Create ticket").click() 225 self.assertMatches('...ticket created...', 226 self.browser.contents) 227 self.browser.open(self.payments_path + '/addop') 228 self.browser.getControl(name="form.p_category").value = ['gown'] 229 self.browser.getControl("Create ticket").click() 230 self.assertMatches('...ticket created...', 231 self.browser.contents) 232 self.browser.open(self.payments_path + '/addop') 233 self.browser.getControl(name="form.p_category").value = ['transfer'] 234 self.browser.getControl("Create ticket").click() 235 self.assertMatches('...ticket created...', 236 self.browser.contents) 237 self.browser.open(self.payments_path + '/addop') 238 self.browser.getControl( 239 name="form.p_category").value = ['bed_allocation'] 240 self.browser.getControl("Create ticket").click() 241 self.assertMatches('...ticket created...', 242 self.browser.contents) 243 self.browser.open(self.payments_path + '/addop') 244 self.browser.getControl( 245 name="form.p_category").value = ['hostel_maintenance'] 246 self.browser.getControl("Create ticket").click() 247 self.assertMatches('...ticket created...', 248 self.browser.contents) 249 self.browser.open(self.payments_path + '/addop') 250 self.browser.getControl(name="form.p_category").value = ['clearance'] 251 self.browser.getControl("Create ticket").click() 252 self.assertMatches('...ticket created...', 253 self.browser.contents) 254 self.browser.open(self.payments_path + '/addop') 255 self.browser.getControl(name="form.p_category").value = ['schoolfee'] 256 self.browser.getControl("Create ticket").click() 257 self.assertMatches('...ticket created...', 258 self.browser.contents) 259 # In state returning we can add a new school fee ticket since 260 # p_session and p_level is different 259 self.browser.getControl(name="form.p_category").value = ['schoolfee_1'] 260 self.browser.getControl("Create ticket").click() 261 self.assertMatches('...ticket created...', 262 self.browser.contents) 263 # In state returning we can't add a new school fee ticket 264 # for the next session because the second instalment is missing ... 261 265 IWorkflowState(self.student).setState('returning') 262 266 self.browser.open(self.payments_path + '/addop') 263 self.browser.getControl(name="form.p_category").value = ['schoolfee'] 264 self.browser.getControl("Create ticket").click() 265 self.assertMatches('...ticket created...', 266 self.browser.contents) 267 # In state admitted school fee can't be determined 268 IWorkflowState(self.student).setState('admitted') 269 self.browser.open(self.payments_path + '/addop') 270 self.browser.getControl(name="form.p_category").value = ['schoolfee'] 271 self.browser.getControl("Create ticket").click() 272 self.assertMatches('...Amount could not be determined...', 267 self.browser.getControl(name="form.p_category").value = ['schoolfee_1'] 268 self.browser.getControl("Create ticket").click() 269 self.assertMatches('...2nd school fee instalment has not yet been paid...', 270 self.browser.contents) 271 self.browser.open(self.payments_path + '/addop') 272 self.browser.getControl(name="form.p_category").value = ['schoolfee_2'] 273 # ... and the first one has not yet been approved. 274 self.browser.getControl("Create ticket").click() 275 self.assertMatches('...1st school fee instalment has not yet been paid...', 276 self.browser.contents) 277 # Ok, then we approve the first instalment ... 278 ctrl = self.browser.getControl(name='val_id') 279 p_id = ctrl.options[0] 280 self.browser.open(self.payments_path + '/' + p_id + '/approve') 281 # ... add the second instalment ... 282 self.browser.open(self.payments_path + '/addop') 283 self.browser.getControl(name="form.p_category").value = ['schoolfee_2'] 284 self.browser.getControl("Create ticket").click() 285 self.assertMatches('...ticket created...', 286 self.browser.contents) 287 # ... approve the second instalment ... 288 ctrl = self.browser.getControl(name='val_id') 289 p_id = ctrl.options[1] 290 self.browser.open(self.payments_path + '/' + p_id + '/approve') 291 # ... and finally add the 1st instalment for the next session. 292 self.browser.open(self.payments_path + '/addop') 293 self.browser.getControl(name="form.p_category").value = ['schoolfee_1'] 294 self.browser.getControl("Create ticket").click() 295 self.assertMatches('...ticket created...', 273 296 self.browser.contents) 274 297 … … 324 347 self.app['configuration']['2004'].booking_fee = 150.0 325 348 self.app['configuration']['2004'].maint_fee = 180.0 349 self.app['configuration']['2004'].clearance_fee = 1234.0 350 self.app['configuration']['2004'].school_fee_base = 6666.0 326 351 utils = getUtility(IStudentsUtils) 327 352 328 error, payment = utils.setPaymentDetails('schoolfee ',self.student)353 error, payment = utils.setPaymentDetails('schoolfee_1',self.student) 329 354 self.assertEqual(payment, None) 330 self.assertEqual(error, u' Amount could not be determined.')355 self.assertEqual(error, u'Wrong state.') 331 356 332 357 IWorkflowState(self.student).setState('cleared') 333 error, payment = utils.setPaymentDetails('schoolfee ',self.student)334 self.assertEqual(payment.p_level, 100) 335 self.assertEqual(payment.p_session, 2004) 336 self.assertEqual(payment.amount_auth, 40000.0)358 error, payment = utils.setPaymentDetails('schoolfee_1',self.student) 359 self.assertEqual(payment.p_level, 100) 360 self.assertEqual(payment.p_session, 2004) 361 self.assertEqual(payment.amount_auth, 6666.0) 337 362 self.assertEqual(payment.p_item, u'CERT1') 338 363 self.assertEqual(error, None) … … 340 365 # Add penalty fee. 341 366 self.app['configuration']['2004'].penalty_ug = 99.0 342 error, payment = utils.setPaymentDetails('schoolfee ',self.student)343 self.assertEqual(payment.amount_auth, 40099.0)367 error, payment = utils.setPaymentDetails('schoolfee_1',self.student) 368 self.assertEqual(payment.amount_auth, 6765.0) 344 369 345 370 IWorkflowState(self.student).setState('returning') 346 error, payment = utils.setPaymentDetails('schoolfee ',self.student)371 error, payment = utils.setPaymentDetails('schoolfee_1',self.student) 347 372 self.assertEqual(payment.p_level, 200) 348 373 self.assertEqual(payment.p_session, 2005) 349 self.assertEqual(payment.amount_auth, 20099.0)374 self.assertEqual(payment.amount_auth, 6765.0) 350 375 self.assertEqual(payment.p_item, u'CERT1') 351 376 self.assertEqual(error, None) … … 354 379 self.assertEqual(payment.p_level, 100) 355 380 self.assertEqual(payment.p_session, 2004) 356 self.assertEqual(payment.amount_auth, 34250.0)381 self.assertEqual(payment.amount_auth, 1234.0) 357 382 self.assertEqual(payment.p_item, u'CERT1') 358 383 self.assertEqual(error, None)
Note: See TracChangeset for help on using the changeset viewer.