[Erp5-report] r28704 - /erp5/trunk/products/ERP5/tests/testPayroll.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Sep 1 04:38:56 CEST 2009


Author: yusuke
Date: Tue Sep  1 04:38:55 2009
New Revision: 28704

URL: http://svn.erp5.org?rev=28704&view=rev
Log:
move assertion for a precision into the scope of pushReport/popReport, because the precision is set in the scope, and it is disappeared on out of the scope

Modified:
    erp5/trunk/products/ERP5/tests/testPayroll.py

Modified: erp5/trunk/products/ERP5/tests/testPayroll.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testPayroll.py?rev=28704&r1=28703&r2=28704&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testPayroll.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testPayroll.py [utf8] Tue Sep  1 04:38:55 2009
@@ -1938,6 +1938,18 @@
       model_line.setDescription('Model line description %s' % index)
       model_line.setIntIndex(index)
       index += 1
+
+  def checkPrecisionOfListBox(self, report_section, precision):
+    here = report_section.getObject(self.portal)
+    report_section.pushReport(self.portal)
+    form = getattr(here, report_section.getFormId())
+    self.portal.REQUEST['here'] = here
+    if form.has_field('listbox'):
+      result = form.listbox.get_value('default',
+                                      render_format='list',
+                                      REQUEST=self.portal.REQUEST)
+      self.assertEquals(precision, self.portal.REQUEST.get('precision'))
+    report_section.popReport(self.portal)
 
 class TestPayroll(TestPayrollMixin):
 
@@ -2550,8 +2562,7 @@
 
     # base_unit_quantity for EUR is set to 0.001 in the created currencies, so the
     # precision is 3. Editable Fields will reuse this precision.
-    precision = self.portal.REQUEST.get('precision')
-    self.assertEquals(3, precision)
+    self.checkPrecisionOfListBox(report_section_list[0], 3)
 
     self.checkLineProperties(data_line_list[0],
                             id=1,
@@ -2935,8 +2946,7 @@
 
     # base_unit_quantity for EUR is set to 0.001 in the created currencies, so the
     # precision is 3. Editable Fields will reuse this precision.
-    precision = self.portal.REQUEST.get('precision')
-    self.assertEquals(3, precision)
+    self.checkPrecisionOfListBox(report_section_list[0], 3)
 
     self.checkLineProperties(data_line_list[0],
                             employee_career_reference='E1',




More information about the Erp5-report mailing list