[Erp5-report] r33832 nicolas.dumazet - /erp5/trunk/products/ERP5/tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Mar 18 08:47:42 CET 2010


Author: nicolas.dumazet
Date: Thu Mar 18 08:47:40 2010
New Revision: 33832

URL: http://svn.erp5.org?rev=33832&view=rev
Log:
Fix getAggregatedAmountList call

The method expects an IAmount as context: it does not make sense to use a
Transformation.
The proper way is to create a TempAmount containing the resource, quantity and
variation properties that one wants.

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

Modified: erp5/trunk/products/ERP5/tests/testApparelTransformation.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testApparelTransformation.py?rev=33832&r1=33831&r2=33832&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testApparelTransformation.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testApparelTransformation.py [utf8] Thu Mar 18 08:47:40 2010
@@ -615,9 +615,17 @@
     """
       Verify aggregated data according to an expected structure
     """
-    for expected in expected_list:
-      aggregated_amount_list = transformation.getAggregatedAmountList(
-        context=transformation.asContext(categories = expected['id']) )
+    from Products.ERP5Type.Document import newTempAmount
+    produced_resource = transformation.getResource()
+
+    for i, expected in enumerate(expected_list):
+      context = newTempAmount(transformation, "temp_amount_%s" % i)
+      context.edit(
+          quantity = 1.0,
+          variation_category_list = expected['id'],
+          resource = produced_resource,
+      )
+      aggregated_amount_list = transformation.getAggregatedAmountList(context)
       expected_amount_list = expected['amount']
       
       # Check the number of aggregated components




More information about the Erp5-report mailing list