[IMP] mrp_bom_version: Include folder "tests".

[IMP] mrp_bom_component_change: Include folder "tests", and programming improvements.
This commit is contained in:
alfredoavanzosc
2015-08-10 13:58:53 +02:00
committed by Kay K. Cross
parent 68273a5b0d
commit 255d23624b
2 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from . import test_mrp_bom_version

View File

@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
import openerp.tests.common as common
class TestMrpBomVersion(common.TransactionCase):
def setUp(self):
super(TestMrpBomVersion, self).setUp()
self.mrp_bom_model = self.env['mrp.bom']
vals = {"product_tmpl_id":
self.env.ref('product.product_product_11_product_template').id,
"active": True,
"bom_line_ids":
[(0, 0, {'product_id':
self.env.ref('product.product_product_5').id}),
(0, 0, {'product_id':
self.env.ref('product.product_product_6').id})],
}
self.new_mrp_bom = self.mrp_bom_model.create(vals)
def test_mrp_bom_version(self):
self.assertEqual(self.new_mrp_bom.state, 'draft',
"No 'draft' state for MRP new BoM")
self.assertEqual(self.new_mrp_bom.version, 1,
"Incorrect version for MRP new BoM")
self.new_mrp_bom.button_activate()
self.assertEqual(self.new_mrp_bom.active, True,
"Incorrect active field for MRP new BoM, after"
" activation")
self.assertEqual(self.new_mrp_bom.state, 'active',
"No 'active' state for MRP new BoM, after activation")
self.new_mrp_bom.button_historical()
self.assertEqual(self.new_mrp_bom.active, False,
"Incorrect active field for MRP new BoM, after"
" historification")
self.assertEqual(self.new_mrp_bom.state, 'historical',
"No 'historical' state for MRP new BoM, after"
" activation")