From 643713dc4bb7255dbdeac52d61d3553b7a3b1493 Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Tue, 3 Nov 2009 16:32:48 +0000
Subject: [PATCH] since the brain is not a zsqlbrain instance here, we cannot
 compare values like 'movement in self.resource.getCurrentInventoryList(...)'
 but we need to compare by their paths.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30261 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testInventoryAPI.py | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/product/ERP5/tests/testInventoryAPI.py b/product/ERP5/tests/testInventoryAPI.py
index 1536b7e4c5..84e35af0fa 100644
--- a/product/ERP5/tests/testInventoryAPI.py
+++ b/product/ERP5/tests/testInventoryAPI.py
@@ -2270,19 +2270,23 @@ class TestInventoryDocument(InventoryAPITestCase):
       simulation_state='delivered')
     transaction.commit()
     self.tic()
-    inventory_kw={'node_uid': self.node_uid,
-                  'at_date': self.INVENTORY_DATE_3 +10}
-    value=self.INVENTORY_QUANTITY_3
+
+    def getCurrentInventoryPathList(resource, **kw):
+      # the brain is not a zsqlbrain instance here, so it does not
+      # have getPath().
+      return [x.path for x in resource.getCurrentInventoryList(**kw)]
    
     # use optimisation
-    self.assertEquals(True,movement in self.resource.getCurrentInventoryList(
-                                        from_date=movement.getStartDate(),
-                                         node_uid=self.node_uid))
+    self.assertTrue(movement.getPath() in getCurrentInventoryPathList(
+      self.resource,
+      node_uid=self.node_uid,
+      from_date=movement.getStartDate()))
+
     # without optimisation
-    self.assertEquals(True,movement in self.resource.getCurrentInventoryList(
-                                     optimisation__=False,
-                                     from_date=movement.getStartDate(),
-                                     node_uid=self.node_uid))
+    self.assertTrue(movement.getPath() in getCurrentInventoryPathList(
+      self.resource,
+      optimisation__=False,
+      from_date=movement.getStartDate()))
     
 class TestUnitConversion(InventoryAPITestCase):
   QUANTITY_UNIT_CATEGORIES = {
-- 
2.30.9