Ignore:
Timestamp:
16 Mar 2015, 10:02:14 (10 years ago)
Author:
Henrik Bettermann
Message:

Prepare contract payment receipt.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py

    r12770 r12772  
    5050from waeup.ikoba.products.productoptions import ProductOption
    5151from waeup.ikoba.customers.interfaces import CurrencyMismatch
     52from waeup.ikoba.payments.payment import Payment
     53from waeup.ikoba.payments.interfaces import IPayer, IPayable, STATE_PAID
    5254
    5355PH_LEN = 15911  # Length of placeholder file
     
    12911293        'Select payment method (final submission)')
    12921294
     1295    def setup_payment(self):
     1296        payer = IPayer(self.customer)
     1297        payable = IPayable(self.contract)
     1298        self.payment = Payment(payer, payable)
     1299        self.payment.gateway_service = 'demo_creditcard'
     1300        self.payment.state = STATE_PAID
     1301        self.app['payments'][self.payment.payment_id] = self.payment
     1302
    12931303    def add_product_option(self, contract):
    12941304        prodoption = ProductOption()
     
    15651575        print "Sample contract_slip.pdf written to %s" % path
    15661576
     1577    def test_view_receipt(self):
     1578        self.add_product_option(self.contract)
     1579        self.setup_payment()
     1580        IWorkflowState(self.document).setState(SUBMITTED)
     1581        self.contract.document_object = self.document
     1582        self.contract.product_object = self.product
     1583        self.contract.title = u'Contract Title'
     1584        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     1585        # Officers can open the receipt
     1586        self.browser.open(self.customer_path + '/contracts/CON1')
     1587        self.browser.getLink("Download payment receipt").click()
     1588        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     1589        self.assertEqual(
     1590            self.browser.headers['Content-Type'], 'application/pdf')
     1591        path = os.path.join(samples_dir(), 'contract_payment_receipt.pdf')
     1592        open(path, 'wb').write(self.browser.contents)
     1593        print "Sample contract_payment_receipt.pdf written to %s" % path
     1594
    15671595    def test_contract_approval(self):
    15681596        # This is not a UI test. It's just a functional test.
Note: See TracChangeset for help on using the changeset viewer.