[Erp5-report] r11740 - /erp5/trunk/products/ERP5/tests/testAmount.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Dec 18 16:30:09 CET 2006


Author: jerome
Date: Mon Dec 18 16:30:06 2006
New Revision: 11740

URL: http://svn.erp5.org?rev=11740&view=rev
Log:
run testAmount with AccountingTransactionLine and add some specific tests for
asset price with accounting transaction lines


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

Modified: erp5/trunk/products/ERP5/tests/testAmount.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testAmount.py?rev=11740&r1=11739&r2=11740&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testAmount.py (original)
+++ erp5/trunk/products/ERP5/tests/testAmount.py Mon Dec 18 16:30:06 2006
@@ -329,6 +329,60 @@
   
   # TODO: test asset price
 
+class TestAccountingTransactionLine(TestMovement):
+  """Tests for Accounting Transaction Line class, which have an overloaded
+  'edit' method.
+  """
+  def _makeOne(self, *args, **kw):
+    from Products.ERP5.Document.AccountingTransactionLine import \
+          AccountingTransactionLine
+    mvt = AccountingTransactionLine(*args, **kw)
+    return mvt.__of__(self.portal)
+
+  def testPrice(self):
+    # price is always 1 for accounting transactions lines
+    mvt = self._makeOne('mvt')
+    self.assertEquals(1, mvt.getPrice())
+  
+  def testQuantity(self):
+    mvt = self._makeOne('mvt')
+    mvt.setQuantity(10)
+    self.assertEquals(10, mvt.getQuantity())
+    # self.assertEquals(None, mvt.getTotalPrice()) 
+    # ... not with Accounting Transaction Lines, because price is 1
+    mvt.edit(quantity=20)
+    self.assertEquals(20, mvt.getQuantity())
+
+  def testDefautSourceTotalAssetDebit(self):
+    mvt = self._makeOne('mvt')
+    mvt.edit(source_debit=100)
+    self.assertEquals(100, mvt.getSourceInventoriatedTotalAssetDebit())
+    self.assertEquals(0, mvt.getSourceInventoriatedTotalAssetCredit())
+    self.assertEquals(100, mvt.getSourceInventoriatedTotalAssetPrice())
+    
+  def testDefautSourceTotalAssetCredit(self):
+    mvt = self._makeOne('mvt')
+    mvt.edit(source_credit=100)
+    self.assertEquals(0, mvt.getSourceInventoriatedTotalAssetDebit())
+    self.assertEquals(100, mvt.getSourceInventoriatedTotalAssetCredit())
+    self.assertEquals(-100, mvt.getSourceInventoriatedTotalAssetPrice())
+  
+  def testDefautDestinationTotalAssetDebit(self):
+    mvt = self._makeOne('mvt')
+    mvt.edit(destination_debit=100)
+    self.assertEquals(100, mvt.getDestinationInventoriatedTotalAssetDebit())
+    self.assertEquals(0, mvt.getDestinationInventoriatedTotalAssetCredit())
+    self.assertEquals(100, mvt.getDestinationInventoriatedTotalAssetPrice())
+    
+  def testDefautDestinationTotalAssetCredit(self):
+    mvt = self._makeOne('mvt')
+    mvt.edit(destination_credit=100)
+    self.assertEquals(0, mvt.getDestinationInventoriatedTotalAssetDebit())
+    self.assertEquals(100, mvt.getDestinationInventoriatedTotalAssetCredit())
+    self.assertEquals(-100, mvt.getDestinationInventoriatedTotalAssetPrice())
+  
+  # TODO: more asset price tests
+
 if __name__ == '__main__':
   framework()
 else:
@@ -337,4 +391,5 @@
     suite = unittest.TestSuite()
     suite.addTest(unittest.makeSuite(TestAmount))
     suite.addTest(unittest.makeSuite(TestMovement))
+    suite.addTest(unittest.makeSuite(TestAccountingTransactionLine))
     return suite




More information about the Erp5-report mailing list