From 718dc208490062ac9e86bd80491e6b207e43eeb9 Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Tue, 16 Feb 2010 09:12:27 +0000
Subject: [PATCH] modify according to the new simulation hierarchy.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32589 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../tests/testTestTaxLineTradeCondition.py    | 21 ++++++++++++-------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/product/ERP5/tests/testTestTaxLineTradeCondition.py b/product/ERP5/tests/testTestTaxLineTradeCondition.py
index 0a3dd9a987..1c6bc221c0 100644
--- a/product/ERP5/tests/testTestTaxLineTradeCondition.py
+++ b/product/ERP5/tests/testTestTaxLineTradeCondition.py
@@ -686,10 +686,15 @@ class TestTaxLineOrderSimulation(AccountingBuildTestCase):
                                    portal_type='Simulation Movement')
     self.assertEquals(1, len(simulation_movement_list))
     level2_applied_rule_list = simulation_movement_list[0].contentValues()
-    self.assertEquals(2, len(level2_applied_rule_list))
+    self.assertEquals(1, len(level2_applied_rule_list))
+    level2_applied_rule = level2_applied_rule_list[0]
+    simulation_movement_list = level2_applied_rule.contentValues(
+                                   portal_type='Simulation Movement')
+    level3_applied_rule_list = simulation_movement_list[0].contentValues()
+    self.assertEquals(2, len(level3_applied_rule_list))
     # first test the invoice movement, they should have base_contribution set
     # correctly
-    invoice_rule_list = [ar for ar in level2_applied_rule_list if
+    invoice_rule_list = [ar for ar in level3_applied_rule_list if
              ar.getSpecialiseValue().getPortalType() == 'Invoicing Rule']
     self.assertEquals(1, len(invoice_rule_list))
     invoice_simulation_movement_list = invoice_rule_list[0].contentValues()
@@ -772,9 +777,9 @@ class TestTaxLineOrderSimulation(AccountingBuildTestCase):
     self.assertEquals(2, len(simulation_movement_list))
     # line 1
     line1_simulation_movement_list = [sm for sm in simulation_movement_list
-          if sm.getOrderValue() == order_line1]
+          if sm.getDeliveryValue() == order_line1]
     self.assertEquals(1, len(line1_simulation_movement_list))
-    simulation_movement = line1_simulation_movement_list[0]
+    simulation_movement = line1_simulation_movement_list[0].contentValues()[0].contentValues()[0]
     self.assertEquals(2.0, simulation_movement.getQuantity())
     applied_tax_rule_list = [ar for ar in simulation_movement.objectValues()
         if ar.getSpecialiseValue().getPortalType() == 'Tax Rule']
@@ -790,9 +795,9 @@ class TestTaxLineOrderSimulation(AccountingBuildTestCase):
     
     # line 2
     line2_simulation_movement_list = [sm for sm in simulation_movement_list
-          if sm.getOrderValue() == order_line2]
+          if sm.getDeliveryValue() == order_line2]
     self.assertEquals(1, len(line2_simulation_movement_list))
-    simulation_movement = line2_simulation_movement_list[0]
+    simulation_movement = line2_simulation_movement_list[0].contentValues()[0].contentValues()[0]
     self.assertEquals(7., simulation_movement.getQuantity())
     applied_tax_rule_list = [ar for ar in simulation_movement.objectValues()
         if ar.getSpecialiseValue().getPortalType() == 'Tax Rule']
@@ -1168,7 +1173,7 @@ class TestTaxLineInvoiceSimulation(AccountingBuildTestCase):
                                    portal_type='Simulation Movement')
     self.assertEquals(2, len(simulation_movement_list))
     tax_simulation_movement_list = [m for m in simulation_movement_list
-                                    if m.getOrderValue() == tax_line]
+                                    if m.getDeliveryValue() == tax_line]
     self.assertEquals(1, len(tax_simulation_movement_list))
     tax_simulation_movement = tax_simulation_movement_list[0]
     self.assertEquals([base_1],
@@ -1179,7 +1184,7 @@ class TestTaxLineInvoiceSimulation(AccountingBuildTestCase):
                       tax_simulation_movement.getPriceCurrencyValue())
 
     invoice_simulation_movement_list = [m for m in simulation_movement_list
-                                    if m.getOrderValue() == invoice_line]
+                                    if m.getDeliveryValue() == invoice_line]
     self.assertEquals(1, len(invoice_simulation_movement_list))
     invoice_simulation_movement = invoice_simulation_movement_list[0]
     self.assertEquals([base_1],
-- 
2.30.9