[IMP] account_asset_management: improve test suite comments

This commit is contained in:
Stéphane Bidoul
2015-01-10 15:33:48 +01:00
parent b5b5ab3aef
commit a93efeaacf

View File

@@ -35,9 +35,8 @@ class TestAssetManagement(common.TransactionCase):
self.asset_model = self.registry('account.asset.asset')
self.dl_model = self.registry('account.asset.depreciation.line')
def test_1(self):
""" Compute depreciation boards and post assets for first year,
verify the depreciation values and values in parent assets. """
def test_1_hierarchy(self):
"""Test computations across the asset hierarchy."""
#
# first load demo assets and do some sanity checks
#
@@ -72,7 +71,7 @@ class TestAssetManagement(common.TransactionCase):
self.assertEquals(fa.asset_value, 11500)
#
# compute depreciation boards
# I compute the depreciation boards
#
self.asset_model.compute_depreciation_board(
self.cr, self.uid, [ict0.id, vehicle0.id])
@@ -84,7 +83,7 @@ class TestAssetManagement(common.TransactionCase):
self.assertEquals(vehicle0.depreciation_line_ids[1].amount, 2000)
#
# post first depreciation line
# I post the first depreciation line
#
ict0.validate()
ict0.depreciation_line_ids[1].create_move()
@@ -109,7 +108,7 @@ class TestAssetManagement(common.TransactionCase):
self.assertEquals(fa.value_residual, 9000)
#
# change parent and check values
# I change the parent and check values
#
ict0.write({'parent_id': vehicle.id})
ict.refresh()
@@ -122,8 +121,8 @@ class TestAssetManagement(common.TransactionCase):
self.assertEquals(fa.value_depreciated, 2500)
self.assertEquals(fa.value_residual, 9000)
def test_2(self):
""" prorata temporis depreciation """
def test_2_prorata_basic(self):
"""Prorata temporis depreciation basic test."""
asset_id = self.asset_model.create(self.cr, self.uid, {
'name': 'test asset',
'category_id': self.ref('account_asset_management.'
@@ -147,9 +146,9 @@ class TestAssetManagement(common.TransactionCase):
self.assertEquals(asset.depreciation_line_ids[6].amount, 55.55)
self.assertEquals(asset.depreciation_line_ids[-1].amount, 8.22)
def test_3(self):
""" prorata temporis depreciation with initial value in
previous year """
def test_3_proprata_init_prev_year(self):
"""Prorata temporis depreciation with init value in prev year."""
# I create an asset in current year
asset_id = self.asset_model.create(self.cr, self.uid, {
'name': 'test asset',
'category_id': self.ref('account_asset_management.'
@@ -161,6 +160,7 @@ class TestAssetManagement(common.TransactionCase):
'method_period': 'month',
'prorata': True,
})
# I create a initial depreciation line in previous year
self.dl_model.create(self.cr, self.uid, {
'asset_id': asset_id,
'amount': 325.08,
@@ -173,14 +173,15 @@ class TestAssetManagement(common.TransactionCase):
self.asset_model.compute_depreciation_board(
self.cr, self.uid, [asset.id])
asset.refresh()
# I check the depreciated value is the initial value
self.assertEquals(asset.value_depreciated, 325.08)
# I check computed values in the depreciation board
self.assertEquals(asset.depreciation_line_ids[2].amount, 55.55)
self.assertEquals(asset.depreciation_line_ids[3].amount, 55.55)
self.assertEquals(asset.depreciation_line_ids[-1].amount, 8.22)
def test_4(self):
""" prorata temporis depreciation with initial value in
curent year """
def test_4_prorata_init_cur_year(self):
"""Prorata temporis depreciation with init value in curent year."""
asset_id = self.asset_model.create(self.cr, self.uid, {
'name': 'test asset',
'category_id': self.ref('account_asset_management.'
@@ -204,7 +205,9 @@ class TestAssetManagement(common.TransactionCase):
self.asset_model.compute_depreciation_board(
self.cr, self.uid, [asset.id])
asset.refresh()
# I check the depreciated value is the initial value
self.assertEquals(asset.value_depreciated, 279.44)
# I check computed values in the depreciation board
self.assertEquals(asset.depreciation_line_ids[2].amount, 45.64)
self.assertEquals(asset.depreciation_line_ids[3].amount, 55.55)
self.assertEquals(asset.depreciation_line_ids[-1].amount, 8.22)