예제 #1
0
 def assertExportFail(self,
                      content,
                      error=ExternalReferenceError,
                      options={}):
     #transaction.commit()
     exporter = Exporter(content, TestRequest(), options.copy())
     with self.assertRaises(error):
         exporter.getString()
     return exporter
 def export(self, container):
     export = Exporter(container, self.request, {'only_container': True})
     default = container.get_default()
     if default is not None:
         default = Exporter(default, self.request, {'external_rendering': True})
     return {
         'identifier': container.getId(),
         'index': default is not None and default.getString() or None,
         'export': export.getString()}
 def export(self, container):
     export = Exporter(container, self.request, {'only_container': True})
     default = container.get_default()
     if default is not None:
         default = Exporter(default, self.request,
                            {'external_rendering': True})
     return {
         'identifier': container.getId(),
         'index': default is not None and default.getString() or None,
         'export': export.getString()
     }
예제 #4
0
 def assertExportEqual(self, content, filename, options={}):
     """Verify that the xml result of an export is the same than
     the one contained in a test file.
     """
     #transaction.commit()
     exporter = Exporter(content, TestRequest(), options.copy())
     with self.layer.open_fixture(filename) as xml_file:
         expected_xml = xml_file.read().format(
             namespaces=self.getNamespaces(), version=self.getVersion())
         actual_xml = self.genericize(exporter.getString())
         self.assertXMLEqual(expected_xml, actual_xml)
     return exporter
예제 #5
0
 def assertExportEqual(self, content, filename, options={}):
     """Verify that the xml result of an export is the same than
     the one contained in a test file.
     """
     #transaction.commit()
     exporter = Exporter(content, TestRequest(), options.copy())
     with self.layer.open_fixture(filename) as xml_file:
         expected_xml = xml_file.read().format(
             namespaces=self.getNamespaces(),
             version=self.getVersion())
         actual_xml = self.genericize(exporter.getString())
         self.assertXMLEqual(expected_xml, actual_xml)
     return exporter
예제 #6
0
 def assertExportFail(self, content, error=ExternalReferenceError, options={}):
     #transaction.commit()
     exporter = Exporter(content, TestRequest(), options.copy())
     with self.assertRaises(error):
         exporter.getString()
     return exporter