Ignore:
Timestamp:
11 May 2012, 14:18:47 (13 years ago)
Author:
Henrik Bettermann
Message:

Add methods for approving payments and implement pages for approving payments (work in progress).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r8346 r8420  
    176176        configuration.academic_session = 2004
    177177        configuration.clearance_fee = 3456.0
     178        configuration.booking_fee = 123.4
    178179        self.app['configuration'].addSessionConfiguration(configuration)
    179180
     
    12881289                           self.browser.contents)
    12891290
    1290         # Managers can open the callback view which simulates a valid callback
     1291        # Managers can approve the payment
    12911292        self.assertEqual(len(self.app['accesscodes']['SFE-0']),0)
    12921293        self.browser.open(payment_url)
    1293         self.browser.getLink("Request callback").click()
     1294        self.browser.getLink("Approve payment").click()
    12941295        self.assertMatches('...Valid callback received...',
    12951296                          self.browser.contents)
     
    12991300            self.app['accesscodes']['SFE-0'].values()[0].cost,40000.0)
    13001301
    1301         # Callback can't be applied twice
    1302         self.browser.open(payment_url + '/simulate_callback')
     1302        # Payments can't be approved twice
     1303        self.browser.open(payment_url + '/approve')
    13031304        self.assertMatches('...This ticket has already been paid...',
    13041305                          self.browser.contents)
     
    13371338                           self.browser.contents)
    13381339
    1339         # Managers can open the callback view which simulates a valid callback
     1340        # Managers can approve the payment
    13401341        self.assertEqual(len(self.app['accesscodes']['CLR-0']),0)
    13411342        ctrl = self.browser.getControl(name='val_id')
    13421343        value = ctrl.options[1] # The clearance payment is the second in the table
    13431344        self.browser.getLink(value).click()
    1344         self.browser.open(self.browser.url + '/simulate_callback')
     1345        self.browser.open(self.browser.url + '/approve')
    13451346        self.assertMatches('...Valid callback received...',
    13461347                          self.browser.contents)
     
    13721373                           self.browser.contents)
    13731374
    1374         # Students can open the callback view which simulates a valid callback
     1375        # Students can't approve the payment
    13751376        self.assertEqual(len(self.app['accesscodes']['CLR-0']),0)
    13761377        ctrl = self.browser.getControl(name='val_id')
     
    13781379        self.browser.getLink(value).click()
    13791380        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')
    13811385        self.assertMatches('...Valid callback received...',
    13821386                          self.browser.contents)
     
    13851389          <span>Paid</span>
    13861390        </td>...'''
     1391        expected = '''...
     1392        <td>
     1393          <span>Paid</span>
     1394        </td>...'''
    13871395        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')
    13881401        # The new CLR-0 pin has been created
    13891402        self.assertEqual(len(self.app['accesscodes']['CLR-0']),1)
     
    14411454        self.assertEqual(self.student['payments'][value].p_level, 200)
    14421455
    1443         # Students can open the callback view which simulates a valid callback
     1456        # We simulate the approval
    14441457        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')
    14461459        self.assertMatches('...Valid callback received...',
    14471460                          self.browser.contents)
     
    14531466            LookupError, self.browser.getControl, name='val_id')
    14541467        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']
    14561469        self.browser.getControl("Create ticket").click()
    14571470        self.browser.open(self.payments_path)
     
    14951508        value = ctrl.options[0]
    14961509        self.browser.getLink(value).click()
    1497         self.browser.open(self.browser.url + '/simulate_callback')
     1510        self.browser.open(self.browser.url + '/approve')
    14981511        # The new HOS-0 pin has been created
    14991512        self.assertEqual(len(self.app['accesscodes']['HOS-0']),1)
     
    16081621        return
    16091622
    1610     def test_student_accommodation(self):
     1623    def xx_test_student_accommodation(self):
    16111624        # Login
    16121625        self.browser.open(self.login_path)
     
    16241637        value = ctrl.options[0]
    16251638        self.browser.getLink(value).click()
    1626         self.browser.open(self.browser.url + '/simulate_callback')
     1639        self.browser.open(self.browser.url + '/fake_approve')
    16271640        # The new HOS-0 pin has been created
    16281641        self.assertEqual(len(self.app['accesscodes']['HOS-0']),1)
Note: See TracChangeset for help on using the changeset viewer.