changeset 5d79461d2913 in modules/analytic_account:default
details: 
https://hg.tryton.org/modules/analytic_account?cmd=changeset&node=5d79461d2913
description:
        Add tests for analytic line state with several companies
diffstat:

 tests/test_analytic_account.py |  29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diffs (46 lines):

diff -r b5a31178eb1a -r 5d79461d2913 tests/test_analytic_account.py
--- a/tests/test_analytic_account.py    Fri May 28 09:03:22 2021 +0200
+++ b/tests/test_analytic_account.py    Fri May 28 09:03:50 2021 +0200
@@ -136,9 +136,7 @@
                     (Decimal(30), Decimal(100)))
                 self.assertEqual(analytic_account.balance, Decimal(70))
 
-    @with_transaction()
-    def test_move_line_state(self):
-        "Test move line state"
+    def _test_analytic_line_state(self):
         pool = Pool()
         Party = pool.get('party.party')
         AnalyticAccount = pool.get('analytic_account.account')
@@ -214,6 +212,31 @@
             self.assertEqual(expense_line.analytic_state, 'valid')
 
     @with_transaction()
+    def test_move_line_state(self):
+        "Test move line state"
+        self._test_analytic_line_state()
+
+    @with_transaction()
+    def test_move_line_state_roots_several_companies(self):
+        "Test move line state with roots from several companies"
+        pool = Pool()
+        Account = pool.get('analytic_account.account')
+
+        extra_company = create_company()
+        with set_company(extra_company):
+            root, = Account.create([{
+                        'type': 'root',
+                        'name': 'Root',
+                        }])
+            analytic_account, = Account.create([{
+                        'type': 'normal',
+                        'name': 'Analytic Account',
+                        'parent': root.id,
+                        'root': root.id,
+                        }])
+        self._test_analytic_line_state()
+
+    @with_transaction()
     def test_account_distribute(self):
         "Test account distribute"
         pool = Pool()

Reply via email to