Ignore:
Timestamp:
8 Mar 2015, 22:24:33 (10 years ago)
Author:
uli
Message:

Aggregate test helpers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers/tests/test_browser.py

    r12693 r12694  
    12871287    # Tests for contract related views and pages
    12881288
     1289    never_ending_button_text = (
     1290        'Select payment method and proceed to payment '
     1291        'gateway (final submission)')
     1292
     1293    def add_product_option(self, contract):
     1294        prodoption = ProductOption()
     1295        prodoption.title = u'Any product option'
     1296        prodoption.fee = Decimal('88.8')
     1297        prodoption.currency = 'EUR'
     1298        contract.product_options = [prodoption, ]
     1299
     1300    def prepare_payment_select(self):
     1301        IWorkflowState(self.customer).setState('approved')
     1302        IWorkflowState(self.document).setState('verified')
     1303        self.contract.document_object = self.document
     1304        self.add_product_option(self.contract)
     1305        IWorkflowState(self.contract).setState('created')
     1306        # login as customer
     1307        self.browser.open(self.login_path)
     1308        self.browser.getControl(name="form.login").value = self.customer_id
     1309        self.browser.getControl(name="form.password").value = 'cpwd'
     1310        self.browser.getControl("Login").click()
     1311
    12891312    def test_manage_contract(self):
    12901313        # Managers can access the pages of customer contractsconter
     
    15591582        self.assertEqual(IWorkflowState(self.contract).getState(), 'approved')
    15601583
    1561     def add_product_option(self, contract):
    1562         prodoption = ProductOption()
    1563         prodoption.title = u'Any product option'
    1564         prodoption.fee = Decimal('88.8')
    1565         prodoption.currency = 'EUR'
    1566         contract.product_options = [prodoption, ]
    1567 
    1568     def prepare_payment_select(self):
    1569         IWorkflowState(self.customer).setState('approved')
    1570         IWorkflowState(self.document).setState('verified')
    1571         self.contract.document_object = self.document
    1572         self.add_product_option(self.contract)
    1573         IWorkflowState(self.contract).setState('created')
    1574         # login as customer
    1575         self.browser.open(self.login_path)
    1576         self.browser.getControl(name="form.login").value = self.customer_id
    1577         self.browser.getControl(name="form.password").value = 'cpwd'
    1578         self.browser.getControl("Login").click()
    1579 
    15801584    def test_select_payment(self):
    15811585        # select payment
     
    15911595        # we get warned if no payment was selected
    15921596        self.prepare_payment_select()
    1593         never_ending_button_text = (
    1594             'Select payment method and proceed to payment gateway'
    1595             ' (final submission)')
    15961597        self.browser.open(
    15971598            '%s/CON1/select_payment_method' % self.contracts_path)
    1598         self.browser.getControl(never_ending_button_text).click()
     1599        self.browser.getControl(self.never_ending_button_text).click()
    15991600        self.assertTrue(
    16001601            'Please pick a payment method' in self.browser.contents)
     
    16031604        # we can proceed with payments if we select a payment method
    16041605        self.prepare_payment_select()
    1605         never_ending_button_text = (
    1606             'Select payment method and proceed to payment gateway'
    1607             ' (final submission)')
    16081606        self.browser.open(
    16091607            '%s/CON1/select_payment_method' % self.contracts_path)
    16101608        radio_ctrl = self.browser.getControl(name='gw')
    16111609        radio_ctrl.displayValue = ['Credit Card (Demo Payments)']
    1612         self.browser.getControl(never_ending_button_text).click()
     1610        self.browser.getControl(self.never_ending_button_text).click()
    16131611        self.assertTrue(
    16141612            'Payment has been initiated.' in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.