Commit c4d54ee3 authored by Nicolas Dumazet's avatar Nicolas Dumazet

fix TestMovement and TestAccountingTransactionLine so they use portal type classes

instead of instanciating Document classes on the fly


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42913 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 72374e71
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
import unittest import unittest
import os import os
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
...@@ -233,23 +234,35 @@ class TestMovement(ERP5TypeTestCase): ...@@ -233,23 +234,35 @@ class TestMovement(ERP5TypeTestCase):
self.login() self.login()
self.portal = self.getPortal() self.portal = self.getPortal()
if getattr(self.portal, 'dummy_delivery_module', None) is None:
types_tool = self.portal.portal_types
types_tool.newContent(id="My Movement",
type_class="Movement")
types_tool.newContent(id="My Delivery",
type_class="Delivery",
type_allowed_content_type_list=("My Movement",))
types_tool.newContent(id="My Delivery Module",
type_class="Folder",
type_allowed_content_type_list=("My Delivery",))
self.portal.newContent(id="dummy_delivery_module",
portal_type="My Delivery Module")
transaction.commit()
self.delivery_module = self.portal.dummy_delivery_module
def getPortalName(self): def getPortalName(self):
forced_portal_id = os.environ.get('erp5_tests_portal_id') forced_portal_id = os.environ.get('erp5_tests_portal_id')
if forced_portal_id: if forced_portal_id:
return str(forced_portal_id) return str(forced_portal_id)
return 'movement_test' return 'movement_test'
def _makeOne(self, *args, **kw): def _makeOne(self, **kw):
from Products.ERP5.Document.Movement import Movement # returns a Movement inside of a delivery
mvt = Movement(*args, **kw) delivery = self.delivery_module.newContent()
from Products.ERP5.Document.Delivery import Delivery return delivery.newContent(**kw)
delivery = Delivery('delivery').__of__(self.portal)
# return it wrapped in a delivery, so that it can access the types tool in
# _aq_dynamic, and so that getExplanationValue works as expected
return mvt.__of__(delivery)
def testQuantity(self): def testQuantity(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.setQuantity(10) mvt.setQuantity(10)
self.assertEquals(10, mvt.getQuantity()) self.assertEquals(10, mvt.getQuantity())
self.assertEquals(0, mvt.getTotalPrice()) self.assertEquals(0, mvt.getTotalPrice())
...@@ -257,7 +270,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -257,7 +270,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(20, mvt.getQuantity()) self.assertEquals(20, mvt.getQuantity())
def testPrice(self): def testPrice(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
self.assertEquals(None, mvt.getPrice()) self.assertEquals(None, mvt.getPrice())
mvt.setPrice(10) mvt.setPrice(10)
self.assertEquals(10, mvt.getPrice()) self.assertEquals(10, mvt.getPrice())
...@@ -266,7 +279,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -266,7 +279,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(10, mvt.getTotalPrice()) self.assertEquals(10, mvt.getTotalPrice())
def testSourceDebit(self): def testSourceDebit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.setSourceDebit(10) mvt.setSourceDebit(10)
self.assertEquals(10, mvt.getSourceDebit()) self.assertEquals(10, mvt.getSourceDebit())
self.assertEquals(0, mvt.getSourceCredit()) self.assertEquals(0, mvt.getSourceCredit())
...@@ -278,7 +291,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -278,7 +291,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(-20, mvt.getQuantity()) self.assertEquals(-20, mvt.getQuantity())
def testSourceCredit(self): def testSourceCredit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.setSourceCredit(10) mvt.setSourceCredit(10)
self.assertEquals(0, mvt.getSourceDebit()) self.assertEquals(0, mvt.getSourceDebit())
self.assertEquals(10, mvt.getSourceCredit()) self.assertEquals(10, mvt.getSourceCredit())
...@@ -290,7 +303,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -290,7 +303,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(20, mvt.getQuantity()) self.assertEquals(20, mvt.getQuantity())
def testSourceDebitCredit(self): def testSourceDebitCredit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.setSourceCredit(10) mvt.setSourceCredit(10)
mvt.edit(source_credit=0, source_debit=10) mvt.edit(source_credit=0, source_debit=10)
self.assertEquals(10, mvt.getSourceDebit()) self.assertEquals(10, mvt.getSourceDebit())
...@@ -298,7 +311,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -298,7 +311,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(-10, mvt.getQuantity()) self.assertEquals(-10, mvt.getQuantity())
def testDestinationDebit(self): def testDestinationDebit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.setDestinationDebit(10) mvt.setDestinationDebit(10)
self.assertEquals(10, mvt.getDestinationDebit()) self.assertEquals(10, mvt.getDestinationDebit())
self.assertEquals(0, mvt.getDestinationCredit()) self.assertEquals(0, mvt.getDestinationCredit())
...@@ -310,7 +323,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -310,7 +323,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(20, mvt.getQuantity()) self.assertEquals(20, mvt.getQuantity())
def testDestinationCredit(self): def testDestinationCredit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.setDestinationCredit(10) mvt.setDestinationCredit(10)
self.assertEquals(0, mvt.getDestinationDebit()) self.assertEquals(0, mvt.getDestinationDebit())
self.assertEquals(10, mvt.getDestinationCredit()) self.assertEquals(10, mvt.getDestinationCredit())
...@@ -322,7 +335,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -322,7 +335,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(-20, mvt.getQuantity()) self.assertEquals(-20, mvt.getQuantity())
def testDestinationDebitCredit(self): def testDestinationDebitCredit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.setDestinationCredit(10) mvt.setDestinationCredit(10)
mvt.edit(destination_credit=0, destination_debit=10) mvt.edit(destination_credit=0, destination_debit=10)
self.assertEquals(10, mvt.getDestinationDebit()) self.assertEquals(10, mvt.getDestinationDebit())
...@@ -330,7 +343,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -330,7 +343,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(10, mvt.getQuantity()) self.assertEquals(10, mvt.getQuantity())
def testSourceAssetCredit(self): def testSourceAssetCredit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(source_asset_credit=100) mvt.edit(source_asset_credit=100)
self.assertEquals(100, mvt.getSourceAssetCredit()) self.assertEquals(100, mvt.getSourceAssetCredit())
self.assertEquals(0, mvt.getQuantity()) self.assertEquals(0, mvt.getQuantity())
...@@ -343,7 +356,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -343,7 +356,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(200, mvt.getSourceCredit()) self.assertEquals(200, mvt.getSourceCredit())
def testSourceAssetDebit(self): def testSourceAssetDebit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(source_asset_debit=100) mvt.edit(source_asset_debit=100)
self.assertEquals(100, mvt.getSourceAssetDebit()) self.assertEquals(100, mvt.getSourceAssetDebit())
self.assertEquals(0, mvt.getQuantity()) self.assertEquals(0, mvt.getQuantity())
...@@ -356,7 +369,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -356,7 +369,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(200, mvt.getSourceDebit()) self.assertEquals(200, mvt.getSourceDebit())
def testEditSourceAssetDebitAndCredit(self): def testEditSourceAssetDebitAndCredit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(source_asset_debit=100, source_asset_credit=None) mvt.edit(source_asset_debit=100, source_asset_credit=None)
self.assertEquals(100, mvt.getSourceAssetDebit()) self.assertEquals(100, mvt.getSourceAssetDebit())
mvt.edit(source_asset_debit=None, source_asset_credit=100) mvt.edit(source_asset_debit=None, source_asset_credit=100)
...@@ -367,7 +380,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -367,7 +380,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(100, mvt.getSourceAssetCredit()) self.assertEquals(100, mvt.getSourceAssetCredit())
def testDestinationAssetCredit(self): def testDestinationAssetCredit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(destination_asset_credit=100) mvt.edit(destination_asset_credit=100)
self.assertEquals(100, mvt.getDestinationAssetCredit()) self.assertEquals(100, mvt.getDestinationAssetCredit())
self.assertEquals(0, mvt.getQuantity()) self.assertEquals(0, mvt.getQuantity())
...@@ -380,7 +393,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -380,7 +393,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(200, mvt.getDestinationCredit()) self.assertEquals(200, mvt.getDestinationCredit())
def testDestinationAssetDebit(self): def testDestinationAssetDebit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(destination_asset_debit=100) mvt.edit(destination_asset_debit=100)
self.assertEquals(100, mvt.getDestinationAssetDebit()) self.assertEquals(100, mvt.getDestinationAssetDebit())
self.assertEquals(0, mvt.getQuantity()) self.assertEquals(0, mvt.getQuantity())
...@@ -393,7 +406,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -393,7 +406,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(200, mvt.getDestinationDebit()) self.assertEquals(200, mvt.getDestinationDebit())
def testEditDestinationAssetDebitAndCredit(self): def testEditDestinationAssetDebitAndCredit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(destination_asset_debit=100, destination_asset_credit=None) mvt.edit(destination_asset_debit=100, destination_asset_credit=None)
self.assertEquals(100, mvt.getDestinationAssetDebit()) self.assertEquals(100, mvt.getDestinationAssetDebit())
mvt.edit(destination_asset_debit=None, destination_asset_credit=100) mvt.edit(destination_asset_debit=None, destination_asset_credit=100)
...@@ -404,7 +417,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -404,7 +417,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(100, mvt.getDestinationAssetCredit()) self.assertEquals(100, mvt.getDestinationAssetCredit())
def testCancellationAmountGetDestinationCredit(self): def testCancellationAmountGetDestinationCredit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.setCancellationAmount(True) mvt.setCancellationAmount(True)
mvt.setQuantity(10) mvt.setQuantity(10)
self.assertEquals(mvt.getQuantity(), 10) self.assertEquals(mvt.getQuantity(), 10)
...@@ -412,7 +425,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -412,7 +425,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(mvt.getDestinationCredit(), -10) self.assertEquals(mvt.getDestinationCredit(), -10)
def testCancellationAmountGetDestinationDebit(self): def testCancellationAmountGetDestinationDebit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.setCancellationAmount(True) mvt.setCancellationAmount(True)
mvt.setQuantity(-10) mvt.setQuantity(-10)
self.assertEquals(mvt.getQuantity(), -10) self.assertEquals(mvt.getQuantity(), -10)
...@@ -420,7 +433,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -420,7 +433,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(mvt.getDestinationCredit(), 0) self.assertEquals(mvt.getDestinationCredit(), 0)
def testCancellationAmountGetSourceCredit(self): def testCancellationAmountGetSourceCredit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.setCancellationAmount(True) mvt.setCancellationAmount(True)
mvt.setQuantity(-10) mvt.setQuantity(-10)
self.assertEquals(mvt.getQuantity(), -10) self.assertEquals(mvt.getQuantity(), -10)
...@@ -428,7 +441,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -428,7 +441,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(mvt.getSourceCredit(), -10) self.assertEquals(mvt.getSourceCredit(), -10)
def testCancellationAmountGetSourceDebit(self): def testCancellationAmountGetSourceDebit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.setCancellationAmount(True) mvt.setCancellationAmount(True)
mvt.setQuantity(10) mvt.setQuantity(10)
self.assertEquals(mvt.getQuantity(), 10) self.assertEquals(mvt.getQuantity(), 10)
...@@ -436,7 +449,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -436,7 +449,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(mvt.getSourceCredit(), 0) self.assertEquals(mvt.getSourceCredit(), 0)
def testCancellationAmountSetDestinationCredit(self): def testCancellationAmountSetDestinationCredit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.setDestinationCredit(-10) mvt.setDestinationCredit(-10)
self.assertTrue(mvt.isCancellationAmount()) self.assertTrue(mvt.isCancellationAmount())
self.assertEquals(mvt.getDestinationDebit(), 0) self.assertEquals(mvt.getDestinationDebit(), 0)
...@@ -448,7 +461,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -448,7 +461,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(mvt.getDestinationCredit(), 10) self.assertEquals(mvt.getDestinationCredit(), 10)
def testCancellationAmountSetDestinationDebit(self): def testCancellationAmountSetDestinationDebit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.setDestinationDebit(-10) mvt.setDestinationDebit(-10)
self.assertTrue(mvt.isCancellationAmount()) self.assertTrue(mvt.isCancellationAmount())
self.assertEquals(mvt.getDestinationDebit(), -10) self.assertEquals(mvt.getDestinationDebit(), -10)
...@@ -460,7 +473,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -460,7 +473,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(mvt.getDestinationCredit(), 0) self.assertEquals(mvt.getDestinationCredit(), 0)
def testCancellationAmountSetDestinationDebitCredit(self): def testCancellationAmountSetDestinationDebitCredit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(destination_debit=-10, destination_credit=0) mvt.edit(destination_debit=-10, destination_credit=0)
self.assertTrue(mvt.isCancellationAmount()) self.assertTrue(mvt.isCancellationAmount())
self.assertEquals(mvt.getDestinationDebit(), -10) self.assertEquals(mvt.getDestinationDebit(), -10)
...@@ -472,7 +485,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -472,7 +485,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(mvt.getDestinationCredit(), 0) self.assertEquals(mvt.getDestinationCredit(), 0)
def testCancellationAmountSetSourceCredit(self): def testCancellationAmountSetSourceCredit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.setSourceCredit(-10) mvt.setSourceCredit(-10)
self.assertTrue(mvt.isCancellationAmount()) self.assertTrue(mvt.isCancellationAmount())
self.assertEquals(mvt.getSourceDebit(), 0) self.assertEquals(mvt.getSourceDebit(), 0)
...@@ -484,7 +497,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -484,7 +497,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(mvt.getSourceCredit(), 10) self.assertEquals(mvt.getSourceCredit(), 10)
def testCancellationAmountSetSourceDebit(self): def testCancellationAmountSetSourceDebit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.setSourceDebit(-10) mvt.setSourceDebit(-10)
self.assertTrue(mvt.isCancellationAmount()) self.assertTrue(mvt.isCancellationAmount())
self.assertEquals(mvt.getSourceDebit(), -10) self.assertEquals(mvt.getSourceDebit(), -10)
...@@ -496,7 +509,7 @@ class TestMovement(ERP5TypeTestCase): ...@@ -496,7 +509,7 @@ class TestMovement(ERP5TypeTestCase):
self.assertEquals(mvt.getSourceCredit(), 0) self.assertEquals(mvt.getSourceCredit(), 0)
def testCancellationAmountSetSourceDebitCredit(self): def testCancellationAmountSetSourceDebitCredit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(source_debit=-10, source_credit=0) mvt.edit(source_debit=-10, source_credit=0)
self.assertTrue(mvt.isCancellationAmount()) self.assertTrue(mvt.isCancellationAmount())
self.assertEquals(mvt.getSourceDebit(), -10) self.assertEquals(mvt.getSourceDebit(), -10)
...@@ -512,19 +525,34 @@ class TestAccountingTransactionLine(TestMovement): ...@@ -512,19 +525,34 @@ class TestAccountingTransactionLine(TestMovement):
"""Tests for Accounting Transaction Line class, which have an overloaded """Tests for Accounting Transaction Line class, which have an overloaded
'edit' method. 'edit' method.
""" """
def _makeOne(self, *args, **kw): def afterSetUp(self):
from Products.ERP5.Document.AccountingTransactionLine import \ self.login()
AccountingTransactionLine self.portal = self.getPortal()
mvt = AccountingTransactionLine(*args, **kw)
return mvt.__of__(self.portal) if getattr(self.portal, 'accounting_transaction_line_module', None) is None:
types_tool = self.portal.portal_types
types_tool.newContent(id="My Accounting Transaction Line",
type_class="AccountingTransactionLine")
types_tool.newContent(
id="My Accounting Transaction Line Module",
type_class="Folder",
type_allowed_content_type_list=("My Accounting Transaction Line",))
self.portal.newContent(id="accounting_transaction_line_module",
portal_type="My Accounting Transaction Line Module")
transaction.commit()
self.atl_module = self.portal.accounting_transaction_line_module
def _makeOne(self, **kw):
return self.atl_module.newContent(**kw)
def testPrice(self): def testPrice(self):
# price is always 1 for accounting transactions lines # price is always 1 for accounting transactions lines
mvt = self._makeOne('mvt') mvt = self._makeOne()
self.assertEquals(1, mvt.getPrice()) self.assertEquals(1, mvt.getPrice())
def testQuantity(self): def testQuantity(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.setQuantity(10) mvt.setQuantity(10)
self.assertEquals(10, mvt.getQuantity()) self.assertEquals(10, mvt.getQuantity())
# self.assertEquals(None, mvt.getTotalPrice()) # self.assertEquals(None, mvt.getTotalPrice())
...@@ -533,7 +561,7 @@ class TestAccountingTransactionLine(TestMovement): ...@@ -533,7 +561,7 @@ class TestAccountingTransactionLine(TestMovement):
self.assertEquals(20, mvt.getQuantity()) self.assertEquals(20, mvt.getQuantity())
def testDefautSourceTotalAssetDebit(self): def testDefautSourceTotalAssetDebit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(source_debit=100) mvt.edit(source_debit=100)
self.assertEquals(100, mvt.getSourceInventoriatedTotalAssetDebit()) self.assertEquals(100, mvt.getSourceInventoriatedTotalAssetDebit())
self.assertEquals(0, mvt.getSourceInventoriatedTotalAssetCredit()) self.assertEquals(0, mvt.getSourceInventoriatedTotalAssetCredit())
...@@ -544,7 +572,7 @@ class TestAccountingTransactionLine(TestMovement): ...@@ -544,7 +572,7 @@ class TestAccountingTransactionLine(TestMovement):
self.assertEquals(0.0, mvt.getSourceAssetCredit()) self.assertEquals(0.0, mvt.getSourceAssetCredit())
def testDefautSourceTotalAssetCredit(self): def testDefautSourceTotalAssetCredit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(source_credit=100) mvt.edit(source_credit=100)
self.assertEquals(0, mvt.getSourceInventoriatedTotalAssetDebit()) self.assertEquals(0, mvt.getSourceInventoriatedTotalAssetDebit())
self.assertEquals(100, mvt.getSourceInventoriatedTotalAssetCredit()) self.assertEquals(100, mvt.getSourceInventoriatedTotalAssetCredit())
...@@ -555,7 +583,7 @@ class TestAccountingTransactionLine(TestMovement): ...@@ -555,7 +583,7 @@ class TestAccountingTransactionLine(TestMovement):
self.assertEquals(0.0, mvt.getSourceAssetCredit()) self.assertEquals(0.0, mvt.getSourceAssetCredit())
def testDefautDestinationTotalAssetDebit(self): def testDefautDestinationTotalAssetDebit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(destination_debit=100) mvt.edit(destination_debit=100)
self.assertEquals(100, mvt.getDestinationInventoriatedTotalAssetDebit()) self.assertEquals(100, mvt.getDestinationInventoriatedTotalAssetDebit())
self.assertEquals(0, mvt.getDestinationInventoriatedTotalAssetCredit()) self.assertEquals(0, mvt.getDestinationInventoriatedTotalAssetCredit())
...@@ -566,7 +594,7 @@ class TestAccountingTransactionLine(TestMovement): ...@@ -566,7 +594,7 @@ class TestAccountingTransactionLine(TestMovement):
self.assertEquals(0.0, mvt.getDestinationAssetCredit()) self.assertEquals(0.0, mvt.getDestinationAssetCredit())
def testDefautDestinationTotalAssetCredit(self): def testDefautDestinationTotalAssetCredit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(destination_credit=100) mvt.edit(destination_credit=100)
self.assertEquals(0, mvt.getDestinationInventoriatedTotalAssetDebit()) self.assertEquals(0, mvt.getDestinationInventoriatedTotalAssetDebit())
self.assertEquals(100, mvt.getDestinationInventoriatedTotalAssetCredit()) self.assertEquals(100, mvt.getDestinationInventoriatedTotalAssetCredit())
...@@ -577,7 +605,7 @@ class TestAccountingTransactionLine(TestMovement): ...@@ -577,7 +605,7 @@ class TestAccountingTransactionLine(TestMovement):
self.assertEquals(0.0, mvt.getDestinationAssetCredit()) self.assertEquals(0.0, mvt.getDestinationAssetCredit())
def testSourceAssetCredit(self): def testSourceAssetCredit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(source_asset_credit=100) mvt.edit(source_asset_credit=100)
self.assertEquals(100, mvt.getSourceAssetCredit()) self.assertEquals(100, mvt.getSourceAssetCredit())
self.assertEquals(0, mvt.getQuantity()) self.assertEquals(0, mvt.getQuantity())
...@@ -594,7 +622,7 @@ class TestAccountingTransactionLine(TestMovement): ...@@ -594,7 +622,7 @@ class TestAccountingTransactionLine(TestMovement):
self.assertEquals(-200, mvt.getSourceInventoriatedTotalAssetPrice()) self.assertEquals(-200, mvt.getSourceInventoriatedTotalAssetPrice())
def testSourceAssetDebit(self): def testSourceAssetDebit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(source_asset_debit=100) mvt.edit(source_asset_debit=100)
self.assertEquals(100, mvt.getSourceAssetDebit()) self.assertEquals(100, mvt.getSourceAssetDebit())
self.assertEquals(0, mvt.getQuantity()) self.assertEquals(0, mvt.getQuantity())
...@@ -611,7 +639,7 @@ class TestAccountingTransactionLine(TestMovement): ...@@ -611,7 +639,7 @@ class TestAccountingTransactionLine(TestMovement):
self.assertEquals(200, mvt.getSourceInventoriatedTotalAssetPrice()) self.assertEquals(200, mvt.getSourceInventoriatedTotalAssetPrice())
def testDestinationAssetCredit(self): def testDestinationAssetCredit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(destination_asset_credit=100) mvt.edit(destination_asset_credit=100)
self.assertEquals(100, mvt.getDestinationAssetCredit()) self.assertEquals(100, mvt.getDestinationAssetCredit())
self.assertEquals(0, mvt.getQuantity()) self.assertEquals(0, mvt.getQuantity())
...@@ -628,7 +656,7 @@ class TestAccountingTransactionLine(TestMovement): ...@@ -628,7 +656,7 @@ class TestAccountingTransactionLine(TestMovement):
self.assertEquals(-200, mvt.getDestinationInventoriatedTotalAssetPrice()) self.assertEquals(-200, mvt.getDestinationInventoriatedTotalAssetPrice())
def testDestinationAssetDebit(self): def testDestinationAssetDebit(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(destination_asset_debit=100) mvt.edit(destination_asset_debit=100)
self.assertEquals(100, mvt.getDestinationAssetDebit()) self.assertEquals(100, mvt.getDestinationAssetDebit())
self.assertEquals(0, mvt.getQuantity()) self.assertEquals(0, mvt.getQuantity())
...@@ -645,7 +673,7 @@ class TestAccountingTransactionLine(TestMovement): ...@@ -645,7 +673,7 @@ class TestAccountingTransactionLine(TestMovement):
self.assertEquals(200, mvt.getDestinationInventoriatedTotalAssetPrice()) self.assertEquals(200, mvt.getDestinationInventoriatedTotalAssetPrice())
def testDestinationAssetDebitCancellation(self): def testDestinationAssetDebitCancellation(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(destination_asset_debit=-100) mvt.edit(destination_asset_debit=-100)
self.assertTrue(mvt.isCancellationAmount()) self.assertTrue(mvt.isCancellationAmount())
self.assertEquals(-100, mvt.getDestinationAssetDebit()) self.assertEquals(-100, mvt.getDestinationAssetDebit())
...@@ -655,7 +683,7 @@ class TestAccountingTransactionLine(TestMovement): ...@@ -655,7 +683,7 @@ class TestAccountingTransactionLine(TestMovement):
self.assertEquals(-100, mvt.getDestinationInventoriatedTotalAssetPrice()) self.assertEquals(-100, mvt.getDestinationInventoriatedTotalAssetPrice())
def testDestinationAssetCreditCancellation(self): def testDestinationAssetCreditCancellation(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(destination_asset_credit=-100) mvt.edit(destination_asset_credit=-100)
self.assertTrue(mvt.isCancellationAmount()) self.assertTrue(mvt.isCancellationAmount())
self.assertEquals(-100, mvt.getDestinationAssetCredit()) self.assertEquals(-100, mvt.getDestinationAssetCredit())
...@@ -665,7 +693,7 @@ class TestAccountingTransactionLine(TestMovement): ...@@ -665,7 +693,7 @@ class TestAccountingTransactionLine(TestMovement):
self.assertEquals(100, mvt.getDestinationInventoriatedTotalAssetPrice()) self.assertEquals(100, mvt.getDestinationInventoriatedTotalAssetPrice())
def testSourceAssetDebitCancellation(self): def testSourceAssetDebitCancellation(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(source_asset_debit=-100) mvt.edit(source_asset_debit=-100)
self.assertTrue(mvt.isCancellationAmount()) self.assertTrue(mvt.isCancellationAmount())
self.assertEquals(-100, mvt.getSourceAssetDebit()) self.assertEquals(-100, mvt.getSourceAssetDebit())
...@@ -675,7 +703,7 @@ class TestAccountingTransactionLine(TestMovement): ...@@ -675,7 +703,7 @@ class TestAccountingTransactionLine(TestMovement):
self.assertEquals(-100, mvt.getSourceInventoriatedTotalAssetPrice()) self.assertEquals(-100, mvt.getSourceInventoriatedTotalAssetPrice())
def testSourceAssetCreditCancellation(self): def testSourceAssetCreditCancellation(self):
mvt = self._makeOne('mvt') mvt = self._makeOne()
mvt.edit(source_asset_credit=-100) mvt.edit(source_asset_credit=-100)
self.assertTrue(mvt.isCancellationAmount()) self.assertTrue(mvt.isCancellationAmount())
self.assertEquals(-100, mvt.getSourceAssetCredit()) self.assertEquals(-100, mvt.getSourceAssetCredit())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment