Commit 330e017f authored by Jérome Perrin's avatar Jérome Perrin

testDeferredStyle: use OOoDocument API to convert to text

Using portal_transforms is not deterministic, because we don't have
direct chain from ods to text, so the conversion is two steps, either
ods=>html=>text or ods=>pdf=>text.

This caused problem with hash randomization, revealed by
testDeferredStyle.TestODSDeferredStyle.test_report_method_access_request
with PYTHONHASHSEED=538 on python2. When using PYTHONHASHSEED=0 , this
was using ods=>html=>text and the assertion from the test was OK, but
when using ods=>pdf=>text the test fails because the words are cut at
end of line.
parent 9799d77b
......@@ -452,11 +452,16 @@ class TestDeferredStyleBase(DeferredStyleTestCase):
# request parameter.
mail_message = email.message_from_string(self.portal.MailHost._last_message[2])
part, = [x for x in mail_message.walk() if x.get_content_type() == self.content_type]
report_as_txt = self.portal.portal_transforms.convertTo(
'text/plain',
part.get_payload(decode=True),
context=self.portal,
mimetype=self.content_type).getData()
doc = self.portal.document_module.newContent(
portal_type=self.portal_type,
content_type=self.content_type,
data=part.get_payload(decode=True),
temp_object=True,
)
doc.convertToBaseFormat()
report_as_txt = doc.asText()
self.assertIn(
'in_list_method: set_in_dialog_request == set_in_dialog_request, set_in_report_method == set_in_report_method',
report_as_txt)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment