Commit 1a95131a authored by Jérome Perrin's avatar Jérome Perrin

use checkLineProperties helper method for testJournal*



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13344 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7a0c91ea
...@@ -34,7 +34,6 @@ import unittest ...@@ -34,7 +34,6 @@ import unittest
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5.tests.testAccounting import AccountingTestCase from Products.ERP5.tests.testAccounting import AccountingTestCase
from Products.ERP5Form.Selection import Selection
class TestAccountingReports(AccountingTestCase): class TestAccountingReports(AccountingTestCase):
...@@ -189,101 +188,88 @@ class TestAccountingReports(AccountingTestCase): ...@@ -189,101 +188,88 @@ class TestAccountingReports(AccountingTestCase):
'mirror_section_title', 'debit', 'credit']) 'mirror_section_title', 'debit', 'credit'])
# First Transaction # First Transaction
line = data_line_list[0] self.checkLineProperties(data_line_list[0],
self.assertEquals(first.getSourceReference(), specific_reference=first.getSourceReference(),
line.getColumnProperty('specific_reference')) date=DateTime(2006, 2, 2),
self.assertEquals(DateTime(2006, 2, 2), title='First One',
line.getColumnProperty('date')) node_title='41',
self.assertEquals('First One', line.getColumnProperty('title')) mirror_section_title='Client 1',
self.assertEquals('41', line.getColumnProperty('node_title')) debit=119.60,
self.assertEquals('Client 1', credit=0)
line.getColumnProperty('mirror_section_title'))
self.assertEquals(119.60, line.getColumnProperty('debit'))
self.assertEquals(0, line.getColumnProperty('credit'))
line = data_line_list[1]
# some values are only present when we display the first line of the # some values are only present when we display the first line of the
# transaction (this is a way to see different transactions) # transaction (this is a way to see different transactions)
self.failIf(line.getColumnProperty('specific_reference')) self.checkLineProperties(data_line_list[1],
self.failIf(line.getColumnProperty('date')) specific_reference='',
self.failIf(line.getColumnProperty('title')) date=None,
self.assertEquals('4457', line.getColumnProperty('node_title')) title='',
self.assertEquals('Client 1', node_title='4457',
line.getColumnProperty('mirror_section_title')) mirror_section_title='Client 1',
self.assertEquals(0, line.getColumnProperty('debit')) debit=0,
self.assertEquals(19.60, line.getColumnProperty('credit')) credit=19.60)
line = data_line_list[2] self.checkLineProperties(data_line_list[2],
self.failIf(line.getColumnProperty('specific_reference')) specific_reference='',
self.failIf(line.getColumnProperty('date')) date=None,
self.failIf(line.getColumnProperty('title')) title='',
self.assertEquals('7', line.getColumnProperty('node_title')) node_title='7',
self.assertEquals('Client 1', mirror_section_title='Client 1',
line.getColumnProperty('mirror_section_title')) debit=0,
self.assertEquals(0, line.getColumnProperty('debit')) credit=100)
self.assertEquals(100.00, line.getColumnProperty('credit'))
# Second Transaction # Second Transaction
line = data_line_list[3] self.checkLineProperties(data_line_list[3],
self.assertEquals(second.getSourceReference(), specific_reference=second.getSourceReference(),
line.getColumnProperty('specific_reference')) date=DateTime(2006, 2, 2),
self.assertEquals(DateTime(2006, 2, 2), line.getColumnProperty('date')) title='Second One',
self.assertEquals('Second One', line.getColumnProperty('title')) node_title='41',
self.assertEquals('41', line.getColumnProperty('node_title')) mirror_section_title='Client 2',
self.assertEquals('Client 2', debit=239.20,
line.getColumnProperty('mirror_section_title')) credit=0)
self.assertEquals(239.20, line.getColumnProperty('debit')) self.checkLineProperties(data_line_list[4],
self.assertEquals(0, line.getColumnProperty('credit')) specific_reference='',
line = data_line_list[4] date=None,
self.failIf(line.getColumnProperty('specific_reference')) title='',
self.failIf(line.getColumnProperty('date')) node_title='4457',
self.failIf(line.getColumnProperty('title')) mirror_section_title='Client 2',
self.assertEquals('4457', line.getColumnProperty('node_title')) debit=0,
self.assertEquals('Client 2', credit=39.20)
line.getColumnProperty('mirror_section_title')) self.checkLineProperties(data_line_list[5],
self.assertEquals(0, line.getColumnProperty('debit')) specific_reference='',
self.assertEquals(39.20, line.getColumnProperty('credit')) date=None,
line = data_line_list[5] title='',
self.failIf(line.getColumnProperty('specific_reference')) node_title='7',
self.failIf(line.getColumnProperty('date')) mirror_section_title='Client 2',
self.failIf(line.getColumnProperty('title')) debit=0,
self.assertEquals('7', line.getColumnProperty('node_title')) credit=200)
self.assertEquals('Client 2',
line.getColumnProperty('mirror_section_title'))
self.assertEquals(0, line.getColumnProperty('debit'))
self.assertEquals(200, line.getColumnProperty('credit'))
# Third Transaction # Third Transaction
line = data_line_list[6] self.checkLineProperties(data_line_list[6],
self.assertEquals(third.getSourceReference(), specific_reference=third.getSourceReference(),
line.getColumnProperty('specific_reference')) date=DateTime(2006, 2, 2, 2, 2),# 2006/02/02 will
self.assertEquals(DateTime(2006, 2, 2, 2, 2), # 2006/02/02 will be # be displayed, but this rendering level cannot
# displayed, but this rendering level cannot be # be tested with this framework
# tested with this framework title='Third One',
line.getColumnProperty('date')) node_title='41',
self.assertEquals('Third One', line.getColumnProperty('title')) mirror_section_title='John Smith',
self.assertEquals('41', line.getColumnProperty('node_title')) debit=358.80,
self.assertEquals('John Smith', credit=0)
line.getColumnProperty('mirror_section_title')) self.checkLineProperties(data_line_list[7],
self.assertEquals(358.80, line.getColumnProperty('debit')) specific_reference='',
self.assertEquals(0, line.getColumnProperty('credit')) date=None,
line = data_line_list[7] title='',
self.failIf(line.getColumnProperty('specific_reference')) node_title='4457',
self.failIf(line.getColumnProperty('date')) mirror_section_title='John Smith',
self.failIf(line.getColumnProperty('title')) debit=0,
self.assertEquals('4457', line.getColumnProperty('node_title')) credit=58.80)
self.assertEquals('John Smith', self.checkLineProperties(data_line_list[8],
line.getColumnProperty('mirror_section_title')) specific_reference='',
self.assertEquals(0, line.getColumnProperty('debit')) date=None,
self.assertEquals(58.80, line.getColumnProperty('credit')) # If a title is set on the line, we can see it on
line = data_line_list[8] # this report
self.failIf(line.getColumnProperty('specific_reference')) title='Line Title',
self.failIf(line.getColumnProperty('date')) node_title='7',
# If a title is set on the line, we can see it on this report mirror_section_title='John Smith',
self.assertEquals('Line Title', line.getColumnProperty('title')) debit=0,
self.assertEquals('7', line.getColumnProperty('node_title')) credit=300)
self.assertEquals('John Smith',
line.getColumnProperty('mirror_section_title'))
self.assertEquals(0, line.getColumnProperty('debit'))
self.assertEquals(300.0, line.getColumnProperty('credit'))
# Stat Line # Stat Line
stat_line = line_list[-1] stat_line = line_list[-1]
...@@ -354,34 +340,26 @@ class TestAccountingReports(AccountingTestCase): ...@@ -354,34 +340,26 @@ class TestAccountingReports(AccountingTestCase):
# we have 1 transactions with 2 lines # we have 1 transactions with 2 lines
self.assertEquals(2, len(data_line_list)) self.assertEquals(2, len(data_line_list))
line = data_line_list[0] self.checkLineProperties(data_line_list[0],
self.assertEquals(transaction.getSourceReference(), specific_reference=transaction.getSourceReference(),
line.getColumnProperty('specific_reference')) date=DateTime(2006, 2, 2),
self.assertEquals(DateTime(2006, 2, 2), title='Good One',
line.getColumnProperty('date')) node_title='41',
self.assertEquals('Good One', line.getColumnProperty('title')) mirror_section_title='Client 1',
self.assertEquals('41', line.getColumnProperty('node_title')) debit=100,
self.assertEquals('Client 1', credit=0)
line.getColumnProperty('mirror_section_title')) self.checkLineProperties(data_line_list[1],
self.assertEquals(100.00, line.getColumnProperty('debit')) specific_reference='',
self.assertEquals(0, line.getColumnProperty('credit')) date=None,
line = data_line_list[1] title='',
# some values are only present when we display the first line of the node_title='5',
# transaction (this is a way to see different transactions) mirror_section_title='Client 1',
self.failIf(line.getColumnProperty('specific_reference')) debit=0,
self.failIf(line.getColumnProperty('date')) credit=100)
self.failIf(line.getColumnProperty('title'))
self.assertEquals('5', line.getColumnProperty('node_title'))
self.assertEquals('Client 1',
line.getColumnProperty('mirror_section_title'))
self.assertEquals(0, line.getColumnProperty('debit'))
self.assertEquals(100.00, line.getColumnProperty('credit'))
# Stat Line # Stat Line
stat_line = line_list[-1] self.failUnless(line_list[-1].isStatLine())
self.failUnless(stat_line.isStatLine()) self.checkLineProperties(line_list[-1], debit=100, credit=100)
self.assertEquals(100, stat_line.getColumnProperty('debit'))
self.assertEquals(100, stat_line.getColumnProperty('credit'))
def createAccountStatementDataSet(self): def createAccountStatementDataSet(self):
......
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