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,16 +1160,24 @@ class ERP5ReportTestCase(ERP5TypeTestCase): ...@@ -1160,16 +1160,24 @@ class ERP5ReportTestCase(ERP5TypeTestCase):
in the report_section. in the report_section.
""" """
result = None result = None
here = report_section.getObject(self.portal) # Use an independent request, because this is what happens when using
report_section.pushReport(self.portal) # deferred style
form = getattr(here, report_section.getFormId()) request_form = self.portal.REQUEST.form
self.portal.REQUEST['here'] = here try:
if form.has_field('listbox'): # XXX maybe there is better API than just replacing the dict
result = form.listbox.get_value('default', self.portal.REQUEST.form = dict()
render_format='list', here = report_section.getObject(self.portal)
REQUEST=self.portal.REQUEST) report_section.pushReport(self.portal)
report_section.popReport(self.portal) form = getattr(here, report_section.getFormId())
return result self.portal.REQUEST['here'] = here
if form.has_field('listbox'):
result = form.listbox.get_value('default',
render_format='list',
REQUEST=self.portal.REQUEST)
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