Changeset 8471 for main/waeup.kofa/trunk/src/waeup/kofa/students/tests
- Timestamp:
- 20 May 2012, 05:46:07 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r8468 r8471 1483 1483 self.assertTrue('Successfully removed' in self.browser.contents) 1484 1484 1485 # The new SFE-0 pin can be used for starting course registration1485 # The new SFE-0 pin can be used for starting new session 1486 1486 self.browser.open(self.studycourse_path) 1487 self.browser.getLink('Start course registration').click()1487 self.browser.getLink('Start session').click() 1488 1488 pin = self.app['accesscodes']['SFE-0'].keys()[0] 1489 1489 parts = pin.split('-')[1:] … … 1491 1491 self.browser.getControl(name="ac_series").value = sfeseries 1492 1492 self.browser.getControl(name="ac_number").value = sfenumber 1493 self.browser.getControl("Start course registrationnow").click()1494 self.assertMatches('... Course registration has been started...',1493 self.browser.getControl("Start now").click() 1494 self.assertMatches('...Session started...', 1495 1495 self.browser.contents) 1496 1496 self.assertTrue(self.student.state == 'school fee paid') 1497 return 1498 1499 def test_postgraduate_payments(self): 1500 self.certificate.study_mode = 'pg_ft' 1501 self.certificate.start_level = 999 1502 self.certificate.end_level = 999 1503 self.student['studycourse'].current_level = 999 1504 # Login 1505 self.browser.open(self.login_path) 1506 self.browser.getControl(name="form.login").value = self.student_id 1507 self.browser.getControl(name="form.password").value = 'spwd' 1508 self.browser.getControl("Login").click() 1509 # Students can add online school fee payment tickets. 1510 IWorkflowState(self.student).setState('cleared') 1511 self.browser.open(self.payments_path) 1512 self.browser.getControl("Add online payment ticket").click() 1513 self.browser.getControl(name="form.p_category").value = ['schoolfee'] 1514 self.browser.getControl("Create ticket").click() 1515 self.assertMatches('...ticket created...', 1516 self.browser.contents) 1517 ctrl = self.browser.getControl(name='val_id') 1518 value = ctrl.options[0] 1519 self.browser.getLink(value).click() 1520 self.assertMatches('...Amount Authorized...', 1521 self.browser.contents) 1522 # Payment session and level are current ones. 1523 # Postgrads have to school_fee_1. 1524 self.assertEqual(self.student['payments'][value].amount_auth, 40000.0) 1525 self.assertEqual(self.student['payments'][value].p_session, 2004) 1526 self.assertEqual(self.student['payments'][value].p_level, 999) 1527 1528 # We simulate the approval 1529 self.assertEqual(len(self.app['accesscodes']['SFE-0']),0) 1530 self.browser.open(self.browser.url + '/fake_approve') 1531 self.assertMatches('...Successful payment...', 1532 self.browser.contents) 1533 1534 # The new SFE-0 pin can be used for starting session 1535 self.browser.open(self.studycourse_path) 1536 self.browser.getLink('Start session').click() 1537 pin = self.app['accesscodes']['SFE-0'].keys()[0] 1538 parts = pin.split('-')[1:] 1539 sfeseries, sfenumber = parts 1540 self.browser.getControl(name="ac_series").value = sfeseries 1541 self.browser.getControl(name="ac_number").value = sfenumber 1542 self.browser.getControl("Start now").click() 1543 self.assertMatches('...Session started...', 1544 self.browser.contents) 1545 self.assertTrue(self.student.state == 'school fee paid') 1546 1547 # Postgrad students do not need to register courses the 1548 # can just pay for the next session. 1549 self.browser.open(self.payments_path) 1550 # Remove first payment to be sure that we access the right ticket 1551 del self.student['payments'][value] 1552 self.browser.getControl("Add online payment ticket").click() 1553 self.browser.getControl(name="form.p_category").value = ['schoolfee'] 1554 self.browser.getControl("Create ticket").click() 1555 ctrl = self.browser.getControl(name='val_id') 1556 value = ctrl.options[0] 1557 self.browser.getLink(value).click() 1558 # Payment session has increased by one, payment level remains the same. 1559 # Returning Postgraduates have to pay school_fee_2. 1560 self.assertEqual(self.student['payments'][value].amount_auth, 20000.0) 1561 self.assertEqual(self.student['payments'][value].p_session, 2005) 1562 self.assertEqual(self.student['payments'][value].p_level, 999) 1563 1564 # Student is still in old session 1565 self.assertEqual(self.student.current_session, 2004) 1566 1567 # We do not need to pay the ticket if any other 1568 # SFE pin is provided 1569 pin_container = self.app['accesscodes'] 1570 pin_container.createBatch( 1571 datetime.utcnow(), 'some_userid', 'SFE', 9.99, 1) 1572 pin = pin_container['SFE-1'].values()[0].representation 1573 sfeseries, sfenumber = pin.split('-')[1:] 1574 # The new SFE-1 pin can be used for starting new session 1575 self.browser.open(self.studycourse_path) 1576 self.browser.getLink('Start session').click() 1577 self.browser.getControl(name="ac_series").value = sfeseries 1578 self.browser.getControl(name="ac_number").value = sfenumber 1579 self.browser.getControl("Start now").click() 1580 self.assertMatches('...Session started...', 1581 self.browser.contents) 1582 self.assertTrue(self.student.state == 'school fee paid') 1583 # Student is in new session 1584 self.assertEqual(self.student.current_session, 2005) 1585 self.assertEqual(self.student['studycourse'].current_level, 999) 1497 1586 return 1498 1587
Note: See TracChangeset for help on using the changeset viewer.