From b8e6ce3af3d0e55df4c3340a45d88ac7faa2e7b1 Mon Sep 17 00:00:00 2001 From: Maxime Chambreuil Date: Wed, 5 Feb 2020 12:40:54 -0600 Subject: [PATCH] [FIX] stock_location_limit_product: Tests --- .../test_stock_location_limit_product.py | 34 +++++++------------ 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/stock_location_limit_product/tests/test_stock_location_limit_product.py b/stock_location_limit_product/tests/test_stock_location_limit_product.py index 895587704..3576a9a8c 100644 --- a/stock_location_limit_product/tests/test_stock_location_limit_product.py +++ b/stock_location_limit_product/tests/test_stock_location_limit_product.py @@ -31,24 +31,16 @@ class TestStockLocationLimitProduct(TransactionCase): 'usage': 'internal', }) - def test_onchange_uom_id(self): - limit = self.limit_obj - with self.assertRaises(ValidationError): - # constrain is called when create a record. - limit = self.limit_obj.create({ - 'location_id': self.location.id, - 'product_id': self.product.id, - 'qty': 100, - }) - if not limit: - limit = self.limit_obj.create({ - 'location_id': self.location.id, - 'product_id': self.product2.id, - 'qty': 100, - 'uom_id': self.uom.id, - }) - limit.onchange_uom_id() - limit.check_uom_id() - limit_count = len(self.limit_obj.search([])) - self.assertEqual(limit_count, 2) - self.assertEqual(limit.uom_id.id, self.uom.id) + def test_creating_stock_location_limit(self): + self.limit_obj.create({ + 'location_id': self.location.id, + 'product_id': self.product.id, + 'qty': 100, + }) + self.limit_obj.create({ + 'location_id': self.location.id, + 'product_id': self.product2.id, + 'qty': 100, + }) + limit_count = len(self.limit_obj.search([])) + self.assertEqual(limit_count, 2)