From 784a8b489a52db2fc13f3a174faa02feb0b90428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Wed, 20 Sep 2006 18:30:29 +0000 Subject: [PATCH] test for M9 GAP / AccountType consistency checker git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10216 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../ERP5/tests/testAccounting_l10n_fr_m9.py | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/product/ERP5/tests/testAccounting_l10n_fr_m9.py b/product/ERP5/tests/testAccounting_l10n_fr_m9.py index 2ee9a892bd..7b8239e03a 100644 --- a/product/ERP5/tests/testAccounting_l10n_fr_m9.py +++ b/product/ERP5/tests/testAccounting_l10n_fr_m9.py @@ -173,6 +173,51 @@ class TestAccounting_l10n_M9(ERP5TypeTestCase): self.assertRaises(ValidationFailed, self.getWorkflowTool().doActionFor, transmission_sheet, 'emit_action') + def test_AccountTypeConstaintForExpense(self): + account = self._getAccount('account', + gap='fr/m9/6/60/602/6022/60225', + account_type='expense') + self.assertEquals([], account.checkConsistency()) + + def test_AccountTypeConstaintFixForExpense(self): + account = self._getAccount('account', + gap='fr/m9/6/60/602/6022/60225', + account_type='equity') + self.assertEquals(1, len(account.checkConsistency(fixit=1))) + self.assertEquals('expense', account.getAccountType()) + + def test_AccountTypeConstaintForPayable(self): + account = self._getAccount('payable_account', + gap='fr/m9/4/40', + account_type='liability/payable') + self.assertEquals([], account.checkConsistency()) + + def test_AccountTypeConstaintFixForPayable(self): + account = self._getAccount('payable_account', + gap='fr/m9/4/40', + account_type='equity') + self.assertEquals(1, len(account.checkConsistency(fixit=1))) + self.assertEquals('liability/payable', account.getAccountType()) + + def test_AccountTypeConstaintForClass4(self): + # members of class 4 can be payable or receivable + account = self._getAccount('class4_account', + gap='fr/m9/4/44', + account_type='liability/payable') + self.assertEquals([], account.checkConsistency()) + + account.edit(account_type='asset/receivable') + self.assertEquals([], account.checkConsistency()) + + def test_AccountTypeConstaintFixForClass4(self): + # members of class 4 can be payable or receivable + account = self._getAccount('class4_account', + gap='fr/m9/4/44', + account_type='equity') + self.assertEquals(1, len(account.checkConsistency(fixit=1))) + self.failUnless(account.getAccountType() in ('liability/payable', + 'asset/receivable')) + if __name__ == '__main__': framework() else: -- 2.30.9