Commit 95ce1fae authored by Jérome Perrin's avatar Jérome Perrin

ERP5ReportTestCase: clean request form when before rendering report section.

When using erp5_deferred_style, each report section is rendered in an
independant request, so test should not create a situtation where request form
is same for all report section, because request form parameters become
selection parameters.
parent 93fbcdbb
...@@ -1160,6 +1160,12 @@ class ERP5ReportTestCase(ERP5TypeTestCase): ...@@ -1160,6 +1160,12 @@ class ERP5ReportTestCase(ERP5TypeTestCase):
in the report_section. in the report_section.
""" """
result = None result = None
# Use an independent request, because this is what happens when using
# deferred style
request_form = self.portal.REQUEST.form
try:
# XXX maybe there is better API than just replacing the dict
self.portal.REQUEST.form = dict()
here = report_section.getObject(self.portal) here = report_section.getObject(self.portal)
report_section.pushReport(self.portal) report_section.pushReport(self.portal)
form = getattr(here, report_section.getFormId()) form = getattr(here, report_section.getFormId())
...@@ -1168,8 +1174,10 @@ class ERP5ReportTestCase(ERP5TypeTestCase): ...@@ -1168,8 +1174,10 @@ class ERP5ReportTestCase(ERP5TypeTestCase):
result = form.listbox.get_value('default', result = form.listbox.get_value('default',
render_format='list', render_format='list',
REQUEST=self.portal.REQUEST) REQUEST=self.portal.REQUEST)
report_section.popReport(self.portal)
return result return result
finally:
report_section.popReport(self.portal)
self.portal.REQUEST.form = request_form
def checkLineProperties(self, line, **kw): def checkLineProperties(self, line, **kw):
"""Check properties of a report line. """Check properties of a report line.
......
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