Changeset 12369


Ignore:
Timestamp:
3 Jan 2015, 07:12:59 (10 years ago)
Author:
Henrik Bettermann
Message:

Produce at least one slip for visual layout testing.

Remove unused tests folder.

Location:
main/ikobacustom.skeleton/trunk/src/ikobacustom/skeleton
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • main/ikobacustom.skeleton/trunk/src/ikobacustom/skeleton/customers/tests/test_browser.py

    r12367 r12369  
    3838    SkeletonCustomerDocumentProcessor,
    3939    SkeletonContractProcessor)
    40 from ikobacustom.skeleton.testing import FunctionalLayer
     40from ikobacustom.skeleton.testing import FunctionalLayer, samples_dir
    4141
    4242SAMPLE_IMAGE = os.path.join(os.path.dirname(__file__), 'test_image.jpg')
     
    253253        self.assertEqual(
    254254            self.browser.headers['content-type'], 'application/pdf')
     255
     256class ContractUITests(CustomersFullSetup):
     257    # Tests for contract related views and pages
     258
     259    layer = FunctionalLayer
     260
     261    def test_view_slips(self):
     262        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     263        # Officers can open contract slips.
     264        # First we add a submitted document and a product.
     265        IWorkflowState(self.document).setState('submitted')
     266        self.contract.document_object = self.document
     267        self.contract.product_object = self.product
     268        self.contract.tc_dict = {'en': u'<strong>Hello world</strong>'}
     269        self.browser.open(self.customer_path + '/contracts/CON1')
     270        self.browser.getLink("Download contract slip").click()
     271        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     272        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
     273        path = os.path.join(samples_dir(), 'contract_slip.pdf')
     274        open(path, 'wb').write(self.browser.contents)
     275        print "Sample contract_slip.pdf written to %s" % path
  • main/ikobacustom.skeleton/trunk/src/ikobacustom/skeleton/testing.py

    r12175 r12369  
    1818"""Testing support for :mod:`waeup.ikoba`.
    1919"""
    20 import os.path
     20import os
     21import tempfile
    2122import ikobacustom.skeleton
    2223from zope.app.testing.functional import ZCMLLayer
     
    2829FunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'FunctionalLayer',
    2930                            allow_teardown=True)
     31
     32def samples_dir():
     33    # create a directory for sample sheets, if it doesn't exist,
     34    # and return its path.
     35    tmp_dir = os.path.join(
     36        tempfile.gettempdir(), 'ikobacustom.skeleton.pdf-samples')
     37    if not os.path.exists(tmp_dir):
     38        os.mkdir(tmp_dir)
     39    return tmp_dir
Note: See TracChangeset for help on using the changeset viewer.