tests: add full string (de)serialization to import/export tests (#31823)

This commit is contained in:
Nicolas Roche 2019-08-29 11:17:50 +02:00 committed by Frédéric Péters
parent d0842a5729
commit a86a837bb4
2 changed files with 3 additions and 2 deletions

View File

@ -28,7 +28,7 @@ def teardown_module(module):
shutil.rmtree(pub.APP_DIR)
def export_to_indented_xml(formdef, include_id=False):
formdef_xml = formdef.export_to_xml(include_id=include_id)
formdef_xml = ET.fromstring(ET.tostring(formdef.export_to_xml(include_id=include_id)))
indent(formdef_xml)
return formdef_xml

View File

@ -38,7 +38,8 @@ def export_to_indented_xml(workflow, include_id=False):
return workflow_xml
def assert_import_export_works(wf, include_id=False):
wf2 = Workflow.import_from_xml_tree(wf.export_to_xml(include_id), include_id)
wf2 = Workflow.import_from_xml_tree(
ET.fromstring(ET.tostring(wf.export_to_xml(include_id))), include_id)
assert ET.tostring(export_to_indented_xml(wf)) == ET.tostring(export_to_indented_xml(wf2))
return wf2