From 94ad728877501f75e24e1c981a15687249e9eeb3 Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Wed, 26 Jul 2006 14:15:07 +0000
Subject: [PATCH] added currency exchange lines

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8808 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../ERP5Banking/tests/TestERP5BankingMixin.py | 27 ++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/product/ERP5Banking/tests/TestERP5BankingMixin.py b/product/ERP5Banking/tests/TestERP5BankingMixin.py
index 865566103f..16747418aa 100644
--- a/product/ERP5Banking/tests/TestERP5BankingMixin.py
+++ b/product/ERP5Banking/tests/TestERP5BankingMixin.py
@@ -241,6 +241,12 @@ class TestERP5BankingMixin:
     """
     return getattr(self.getPortal(), 'checkbook_usual_cash_transfer_module', None)
 
+  def getCheckbookMovementModule(self):
+    """
+    Return the Checkbook Movement Module
+    """
+    return getattr(self.getPortal(), 'checkbook_movement_module', None)
+
   def getCheckModule(self):
     """
     Return the Check Module
@@ -273,7 +279,21 @@ class TestERP5BankingMixin:
 
   def createCurrency(self, id='EUR', title='Euro'):
     # create the currency document for euro inside the currency module
-    return self.currency_module.newContent(id=id, title=title)
+    currency = self.currency_module.newContent(id=id, title=title)
+    if id!='EUR':
+      # Create an exchange line
+      exchange_line = currency.newContent(portal_type='Currency Exchange Line',
+          start_date='01/01/1900',stop_date='01/01/2900',
+          price_currency='currency_module/EUR',
+          currency_exchange_type_list=['currency_exchange_type/sale',
+                                       'currency_exchange_type/purchase'],
+          base_price=2)
+      cell_list = exchange_line.objectValues()
+      self.assertEquals(len(cell_list),2)
+      for cell in cell_list:
+        cell.setBasePrice(2.1)
+        cell.setDiscount(0.1)
+    return currency
 
 
   def createBanknotesAndCoins(self):
@@ -408,6 +428,11 @@ class TestERP5BankingMixin:
     self.variation_base_category = getattr(self.category_tool, 'quantity_unit')
     self.unit = self.variation_base_category.newContent(id='unit', title='Unit')
 
+    # add category for currency_exchange_type
+    self.currency_exchange_type = getattr(self.category_tool,'currency_exchange_type')
+    self.currency_exchange_type.newContent(id='sale')
+    self.currency_exchange_type.newContent(id='purchase')
+
     # get the base category function
     self.function_base_category = getattr(self.category_tool, 'function')
     # add category banking in function which will hold all functions neccessary in a bank (at least for this unit test)
-- 
2.30.9