From 4f15f7a1bd1fc5c47cee774c999534ce274c2b50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Wed, 14 Mar 2007 18:51:13 +0000
Subject: [PATCH] first test for trial balance

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13423 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testAccountingReports.py | 24 ++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/product/ERP5/tests/testAccountingReports.py b/product/ERP5/tests/testAccountingReports.py
index a71e6a3829..22d8ae289b 100644
--- a/product/ERP5/tests/testAccountingReports.py
+++ b/product/ERP5/tests/testAccountingReports.py
@@ -706,7 +706,7 @@ class TestAccountingReports(AccountingTestCase):
     # Simulation State parameter is taken into account.
     self.createAccountStatementDataSet()
     
-    # set request variables and render                 
+    # set request variables and render
     request_form = self.portal.REQUEST.form
     request_form['node'] = \
                   self.portal.account_module.receivable.getRelativeUrl()
@@ -734,6 +734,28 @@ class TestAccountingReports(AccountingTestCase):
     self.checkLineProperties(line_list[-1], debit=700, credit=0)
 
 
+  def testTrialBalance(self):
+    # Simple test of trial balance
+    # we will use the same data set as account statement
+    self.createAccountStatementDataSet()
+
+    # set request variables and render
+    request_form = self.portal.REQUEST.form
+    request_form['from_date'] = DateTime(2006, 1, 1)
+    request_form['at_date'] = DateTime(2006, 12, 31)
+    request_form['section_category'] = 'group/demo_group'
+    request_form['simulation_state'] = ['stopped']
+
+    report_section_list = self.getReportSectionList(
+                                    'AccountModule_viewTrialBalanceReport')
+    self.assertEquals(1, len(report_section_list))
+    line_list = self.getListBoxLineList(report_section_list[0])
+    data_line_list = [l for l in line_list if l.isDataLine()]
+    # all accounts are present
+    self.assertEquals(len(portal.account_module.objectIds()),
+                      len(data_line_list))
+
+
 def test_suite():
   suite = unittest.TestSuite()
   suite.addTest(unittest.makeSuite(TestAccountingReports))
-- 
2.30.9