- Timestamp:
- 11 May 2012, 14:18:47 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r8346 r8420 176 176 configuration.academic_session = 2004 177 177 configuration.clearance_fee = 3456.0 178 configuration.booking_fee = 123.4 178 179 self.app['configuration'].addSessionConfiguration(configuration) 179 180 … … 1288 1289 self.browser.contents) 1289 1290 1290 # Managers can open the callback view which simulates a valid callback1291 # Managers can approve the payment 1291 1292 self.assertEqual(len(self.app['accesscodes']['SFE-0']),0) 1292 1293 self.browser.open(payment_url) 1293 self.browser.getLink(" Request callback").click()1294 self.browser.getLink("Approve payment").click() 1294 1295 self.assertMatches('...Valid callback received...', 1295 1296 self.browser.contents) … … 1299 1300 self.app['accesscodes']['SFE-0'].values()[0].cost,40000.0) 1300 1301 1301 # Callback can't be applied twice1302 self.browser.open(payment_url + '/ simulate_callback')1302 # Payments can't be approved twice 1303 self.browser.open(payment_url + '/approve') 1303 1304 self.assertMatches('...This ticket has already been paid...', 1304 1305 self.browser.contents) … … 1337 1338 self.browser.contents) 1338 1339 1339 # Managers can open the callback view which simulates a valid callback1340 # Managers can approve the payment 1340 1341 self.assertEqual(len(self.app['accesscodes']['CLR-0']),0) 1341 1342 ctrl = self.browser.getControl(name='val_id') 1342 1343 value = ctrl.options[1] # The clearance payment is the second in the table 1343 1344 self.browser.getLink(value).click() 1344 self.browser.open(self.browser.url + '/ simulate_callback')1345 self.browser.open(self.browser.url + '/approve') 1345 1346 self.assertMatches('...Valid callback received...', 1346 1347 self.browser.contents) … … 1372 1373 self.browser.contents) 1373 1374 1374 # Students can open the callback view which simulates a valid callback1375 # Students can't approve the payment 1375 1376 self.assertEqual(len(self.app['accesscodes']['CLR-0']),0) 1376 1377 ctrl = self.browser.getControl(name='val_id') … … 1378 1379 self.browser.getLink(value).click() 1379 1380 payment_url = self.browser.url 1380 self.browser.open(payment_url + '/simulate_callback') 1381 self.assertRaises( 1382 Unauthorized, self.browser.open, payment_url + '/approve') 1383 # In the base package they can 'use' a fake approval view 1384 self.browser.open(payment_url + '/fake_approve') 1381 1385 self.assertMatches('...Valid callback received...', 1382 1386 self.browser.contents) … … 1385 1389 <span>Paid</span> 1386 1390 </td>...''' 1391 expected = '''... 1392 <td> 1393 <span>Paid</span> 1394 </td>...''' 1387 1395 self.assertMatches(expected,self.browser.contents) 1396 payment_id = self.student['payments'].keys()[0] 1397 payment = self.student['payments'][payment_id] 1398 self.assertEqual(payment.p_state, 'paid') 1399 self.assertEqual(payment.r_amount_approved, 3456.0) 1400 self.assertEqual(payment.r_code, 'AP') 1388 1401 # The new CLR-0 pin has been created 1389 1402 self.assertEqual(len(self.app['accesscodes']['CLR-0']),1) … … 1441 1454 self.assertEqual(self.student['payments'][value].p_level, 200) 1442 1455 1443 # Students can open the callback view which simulates a valid callback1456 # We simulate the approval 1444 1457 self.assertEqual(len(self.app['accesscodes']['SFE-0']),0) 1445 self.browser.open(self.browser.url + '/ simulate_callback')1458 self.browser.open(self.browser.url + '/fake_approve') 1446 1459 self.assertMatches('...Valid callback received...', 1447 1460 self.browser.contents) … … 1453 1466 LookupError, self.browser.getControl, name='val_id') 1454 1467 self.browser.open(self.payments_path + '/addop') 1455 self.browser.getControl(name="form.p_category").value = [' gown']1468 self.browser.getControl(name="form.p_category").value = ['bed_allocation'] 1456 1469 self.browser.getControl("Create ticket").click() 1457 1470 self.browser.open(self.payments_path) … … 1495 1508 value = ctrl.options[0] 1496 1509 self.browser.getLink(value).click() 1497 self.browser.open(self.browser.url + '/ simulate_callback')1510 self.browser.open(self.browser.url + '/approve') 1498 1511 # The new HOS-0 pin has been created 1499 1512 self.assertEqual(len(self.app['accesscodes']['HOS-0']),1) … … 1608 1621 return 1609 1622 1610 def test_student_accommodation(self):1623 def xx_test_student_accommodation(self): 1611 1624 # Login 1612 1625 self.browser.open(self.login_path) … … 1624 1637 value = ctrl.options[0] 1625 1638 self.browser.getLink(value).click() 1626 self.browser.open(self.browser.url + '/ simulate_callback')1639 self.browser.open(self.browser.url + '/fake_approve') 1627 1640 # The new HOS-0 pin has been created 1628 1641 self.assertEqual(len(self.app['accesscodes']['HOS-0']),1)
Note: See TracChangeset for help on using the changeset viewer.