Changeset 12825


Ignore:
Timestamp:
24 Mar 2015, 12:45:18 (10 years ago)
Author:
Henrik Bettermann
Message:

Fix template and add test.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba/customers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser_templates/paymentspage.pt

    r12809 r12825  
    1010    <th i18n:translate="">Currency</th>
    1111    <th i18n:translate="">State</th>
    12     <th i18n:translate="">Contract</th>
     12    <th i18n:translate="">Title</th>
    1313  </tr>
    1414  </thead>
    1515  <tbody>
    1616    <tr tal:repeat="value view/payments">
    17       <td tal:content="python: value[0].payment_id[:9]">PAYMENT_ID</td>
    18       <td tal:content="python: layout.formatDatetime(value[0].creation_date)">CREATION DATE</td>
    19       <td tal:content="python: layout.formatDatetime(value[0].payment_date)">PAYMENT DATE</td>
    20       <td tal:content="python: view.gateway_services[value[0].gateway_service].title">SERVICE</td>
    21       <td tal:content="python: value[0].amount">AMOUNT</td>
    22       <td tal:content="python: value[0].currency">CURRENCY</td>
    23       <td tal:content="python: view.payment_states.getTerm(value[0].state).title">STATE</td>
    24       <td>
    25         <span tal:condition="python: value[1] is not None">
    26           <a tal:attributes="href python: view.url(value[2])">
    27             <span tal:content="python: value[1].title">PAYABLETITLE</span>
    28           </a>
    29         </span>
    30       </td>
     17      <td tal:content="python: value.payment_id[:9]">PAYMENT_ID</td>
     18      <td tal:content="python: layout.formatDatetime(value.creation_date)">CREATION DATE</td>
     19      <td tal:content="python: layout.formatDatetime(value.payment_date)">PAYMENT DATE</td>
     20      <td tal:content="python: view.gateway_services[value.gateway_service].title">SERVICE</td>
     21      <td tal:content="python: value.amount">AMOUNT</td>
     22      <td tal:content="python: value.currency">CURRENCY</td>
     23      <td tal:content="python: view.payment_states.getTerm(value.state).title">STATE</td>
     24      <td tal:content="python: value.title">TITLE</td>
    3125    </tr>
    3226  </tbody>
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py

    r12793 r12825  
    16601660        radio_ctrl.displayValue = ['Credit Card (Demo Payments)']
    16611661        self.browser.getControl(self.never_ending_button_text).click()
     1662
     1663
     1664class PaymentsUITests(CustomersFullSetup):
     1665    # Tests for contract related views and pages
     1666
     1667    def setup_payment(self):
     1668        payer = IPayer(self.customer)
     1669        payable = IPayable(self.contract)
     1670        self.payment = Payment(payer, payable)
     1671        self.payment.gateway_service = 'demo_creditcard'
     1672        self.payment.state = STATE_PAID
     1673        self.payment.title = u'My payment'
     1674        self.app['payments'][self.payment.payment_id] = self.payment
     1675
     1676    def add_product_option(self, contract):
     1677        prodoption = ProductOption()
     1678        prodoption.title = u'Any product option'
     1679        prodoption.fee = Decimal('88.8')
     1680        prodoption.currency = 'EUR'
     1681        contract.product_options = [prodoption, ]
     1682
     1683    def test_view_payments(self):
     1684        self.add_product_option(self.contract)
     1685        self.setup_payment()
     1686        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     1687        self.browser.open(self.customer_path)
     1688        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     1689        self.assertEqual(self.browser.url, self.customer_path)
     1690        self.browser.open(self.customer_path)
     1691        self.browser.getLink("Payments", index=1).click()
     1692        self.assertTrue(
     1693            '<td>Credit Card (Demo Payments)</td>' in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.