[Erp5-report] r28301 - /erp5/trunk/products/ERP5/tests/testERP5CurrencyExchangeLine.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Aug 6 17:52:23 CEST 2009


Author: jerome
Date: Thu Aug  6 17:52:21 2009
New Revision: 28301

URL: http://svn.erp5.org?rev=28301&view=rev
Log:
Test explicitly the amount on each line instead of simply comparing to the quantity.
Test for source were wrong, in the case of source, quantity is not the same sign as for destination.


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

Modified: erp5/trunk/products/ERP5/tests/testERP5CurrencyExchangeLine.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testERP5CurrencyExchangeLine.py?rev=28301&r1=28300&r2=28301&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testERP5CurrencyExchangeLine.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testERP5CurrencyExchangeLine.py [utf8] Thu Aug  6 17:52:21 2009
@@ -116,7 +116,7 @@
     new_currency.setTitle('Francs CFA')
     new_currency.setBaseUnitQuantity(1.00)
     transaction.commit()
-    self.tic()#execute transaction
+    self.tic()
     self.organisation1.edit(
                     price_currency=new_currency.getRelativeUrl())
     euro = self.portal.currency_module.euro
@@ -168,7 +168,7 @@
     new_currency.setTitle('Francs CFA')
     new_currency.setBaseUnitQuantity(1.00)
     transaction.commit()
-    self.tic()#execute transaction
+    self.tic()
     self.organisation1.edit(
                    price_currency=new_currency.getRelativeUrl())
     euro = self.portal.currency_module.euro
@@ -234,7 +234,7 @@
     new_currency.setTitle('Francs CFA')
     new_currency.setBaseUnitQuantity(1.00)
     transaction.commit()
-    self.tic()#execute transaction
+    self.tic()
     self.organisation1.edit(
               price_currency=new_currency.getRelativeUrl())
     euro = self.portal.currency_module.euro
@@ -267,8 +267,14 @@
     line_list = invoice.contentValues(
            portal_type=portal.getPortalAccountingMovementTypeList())
     for line in line_list:
-      self.assertEquals(line.getSourceTotalAssetPrice(),
-                         round(655.957*line.getQuantity()))
+      if line.getSourceValue() == self.account_module.goods_purchase:
+        self.assertEquals(line.getSourceTotalAssetDebit(),
+                           327978)
+      elif line.getSourceValue() == self.account_module.receivable:
+        self.assertEquals(line.getSourceTotalAssetCredit(),
+                           327978)
+      else:
+        self.fail('line not found')
 
   def test_NoCurrencyExchangeLineForResourceCurrency(self):
     """
@@ -284,7 +290,7 @@
     new_currency.setTitle('Francs CFA')
     new_currency.setBaseUnitQuantity(1.00)
     transaction.commit()
-    self.tic()#execute transaction
+    self.tic()
     self.organisation1.edit(
                 price_currency=new_currency.getRelativeUrl())
     euro = self.portal.currency_module.euro
@@ -323,7 +329,7 @@
     new_currency.setTitle('Francs CFA')
     new_currency.setBaseUnitQuantity(1.00)
     transaction.commit()
-    self.tic()#execute transaction
+    self.tic()
     self.organisation1.edit(
                price_currency=new_currency.getRelativeUrl())
     euro = self.portal.currency_module.euro
@@ -372,9 +378,16 @@
     line_list = transaction2.contentValues(
            portal_type=portal.getPortalAccountingMovementTypeList())
     for line in line_list:
-      self.assertEquals(line.getDestinationTotalAssetPrice(),
-                    round(655.957*line.getQuantity()))
-                                          
+      if line.getDestinationValue() == self.account_module.goods_purchase:
+        self.assertEquals(line.getDestinationTotalAssetDebit(),
+                           327978)
+      elif line.getDestinationValue() == self.account_module.receivable:
+        self.assertEquals(line.getDestinationTotalAssetCredit(),
+                           327978)
+      else:
+        self.fail('line not found')
+
+
   def test_CreateCELWithNoReferenceCurrency(self):
     """
       Create a currency exchange line with no reference currency
@@ -389,7 +402,7 @@
     new_currency.setTitle('Francs CFA')
     new_currency.setBaseUnitQuantity(1.00)
     transaction.commit()
-    self.tic()#execute transaction
+    self.tic()
     self.organisation1.edit(
             price_currency=new_currency.getRelativeUrl())
     euro = self.portal.currency_module.euro
@@ -441,7 +454,7 @@
     new_currency.setTitle('Francs CFA')
     new_currency.setBaseUnitQuantity(1.00)
     transaction.commit()
-    self.tic()#execute transaction
+    self.tic()
     self.organisation1.edit(
                price_currency=new_currency.getRelativeUrl())
     euro = self.portal.currency_module.euro
@@ -488,11 +501,17 @@
                            form_id='view')
     line_list = invoice.contentValues(
            portal_type=portal.getPortalAccountingMovementTypeList())
-    for line in line_list:
-        self.assertEquals(line.getDestinationTotalAssetPrice(),
-                 round(655.957*line.getQuantity()))
-    
-   
+
+    for line in line_list:
+      if line.getDestinationValue() == self.account_module.goods_purchase:
+        self.assertEquals(line.getDestinationTotalAssetDebit(),
+                           327978)
+      elif line.getDestinationValue() == self.account_module.receivable:
+        self.assertEquals(line.getDestinationTotalAssetCredit(),
+                           327978)
+      else:
+        self.fail('line not found')
+  
 
 def test_suite():
   suite = unittest.TestSuite()




More information about the Erp5-report mailing list