From 289b8568c68d41071d00cf124e2d97698bbbae3c Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Fri, 19 Feb 2010 05:17:26 +0000
Subject: [PATCH] more assertions for payment transaction especially in
 Purchase case.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32825 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testInvoice.py | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/product/ERP5/tests/testInvoice.py b/product/ERP5/tests/testInvoice.py
index 6d517ec49b..57acf1e091 100644
--- a/product/ERP5/tests/testInvoice.py
+++ b/product/ERP5/tests/testInvoice.py
@@ -472,7 +472,10 @@ class TestInvoiceMixin(TestPackingListMixin,
     related_invoice_list = packing_list.getCausalityRelatedValueList(
                      portal_type=self.invoice_portal_type)
 
-    packing_list_building_state = 'started'
+    if packing_list.getPortalType() == 'Purchase Packing List':
+      packing_list_building_state = 'stopped'
+    else:
+      packing_list_building_state = 'started'
     packing_list_state = packing_list.getSimulationState()
     if packing_list_state != packing_list_building_state :
       self.assertEquals(0, len(related_invoice_list))
@@ -572,6 +575,18 @@ class TestInvoiceMixin(TestPackingListMixin,
       self.failUnless(payment is not None)
       # Payments created by Delivery Builder are in planned state
       self.assertEquals(payment.getSimulationState(), 'planned')
+      # Test source section and destination section of payment, that
+      # should be reversed for Purchase case.
+      if invoice.getPortalType() == 'Purchase Invoice Transaction':
+        self.assertEquals(payment.getSourceSection(), \
+                          invoice.getDestinationSection())
+        self.assertEquals(payment.getDestinationSection(), \
+                          invoice.getSourceSection())
+      else:
+        self.assertEquals(payment.getSourceSection(), \
+                          invoice.getSourceSection())
+        self.assertEquals(payment.getDestinationSection(), \
+                          invoice.getDestinationSection())
 
       # Get the list of simulation movements of packing list ...
       invoice_simulation_movement_list = []
-- 
2.30.9