Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(53)  |  Call(53)  |  Derive(0)  |  Import(0)

src/e/r/erp5-HEAD/product/ERP5OOo/tests/testFormPrintoutAsODT.py   erp5(Download)
    # test target
    foo_printout = portal.foo_module.test1.Foo_viewAsPrintout
    self._validate(self.getODFDocumentFromPrintout(foo_printout))
 
    request = self.app.REQUEST
    self.assertEqual(request.RESPONSE.getHeader('content-disposition'),
                     'inline;filename="Foo_viewAsPrintout.odt"')
    self._validate(odf_document)
    pdf_document = foo_printout.index_html(REQUEST=request, format='pdf')
    self.assertEqual(request.RESPONSE.getHeader('content-type'),
    content_xml = builder.extract("content.xml")
    self.assertTrue(content_xml.find("Changed Title!") > 0)
    self._validate(odf_document)
 
    # 3. False case: change the field name
    content_xml = builder.extract("content.xml")
    self.assertFalse(content_xml.find("you cannot find") > 0)
    self._validate(odf_document)
    # put back
    foo_form.manage_renameObject('xxx_title', 'my_title', REQUEST=request)
    self.assertTrue(content_xml.find("call!") > 0)
    self.assertEqual(request.RESPONSE.getHeader('content-type'), 'text/html')
    self._validate(odf_document)
 
    # 5. Normal case: utf-8 string

src/e/r/erp5-HEAD/product/ERP5OOo/tests/testFormPrintoutAsODG.py   erp5(Download)
                                'Foo_001.odg')
    foo_file = open(foo_file_path, 'rb')
    self._validate(foo_file.read())
    custom = self.portal.portal_skins.custom
    addStyleSheet = custom.manage_addProduct['OFSP'].manage_addFile
    foo_printout = portal.foo_module.test1.Foo_viewAsODGPrintout
    original_file_content = self.getODFDocumentFromPrintout(foo_printout)
    self._validate(original_file_content)
 
    # extract content.xml from original odg document
    self.assertEqual(request.RESPONSE.getHeader('content-disposition'),
                     'inline;filename="Foo_viewAsODGPrintout.odg"')
    self._validate(odf_document)
 
    # 2. Normal case: change the field value and check again the ODF document
    content_xml = builder.extract("content.xml")
    self.assertTrue(content_xml.find("Changed Title!") > 0)
    self._validate(odf_document)
 
    # 3. False case: change the field name
    content_xml = builder.extract("content.xml")
    self.assertFalse(content_xml.find("you cannot find") > 0)
    self._validate(odf_document)
    # put back
    foo_form.manage_renameObject('xxx_title', 'my_title', REQUEST=request)