Changeset 12369
- Timestamp:
- 3 Jan 2015, 07:12:59 (10 years ago)
- 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 38 38 SkeletonCustomerDocumentProcessor, 39 39 SkeletonContractProcessor) 40 from ikobacustom.skeleton.testing import FunctionalLayer 40 from ikobacustom.skeleton.testing import FunctionalLayer, samples_dir 41 41 42 42 SAMPLE_IMAGE = os.path.join(os.path.dirname(__file__), 'test_image.jpg') … … 253 253 self.assertEqual( 254 254 self.browser.headers['content-type'], 'application/pdf') 255 256 class 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 18 18 """Testing support for :mod:`waeup.ikoba`. 19 19 """ 20 import os.path 20 import os 21 import tempfile 21 22 import ikobacustom.skeleton 22 23 from zope.app.testing.functional import ZCMLLayer … … 28 29 FunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'FunctionalLayer', 29 30 allow_teardown=True) 31 32 def 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.