From 25118e8d82c727d3f8394b4813d99c63cf06b1ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com> Date: Fri, 24 Apr 2009 16:01:59 +0000 Subject: [PATCH] - test default supply line behaviour on resource copy & paste git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26625 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/tests/testResource.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/product/ERP5/tests/testResource.py b/product/ERP5/tests/testResource.py index c05827f36f..59b3c2a07b 100644 --- a/product/ERP5/tests/testResource.py +++ b/product/ERP5/tests/testResource.py @@ -999,6 +999,36 @@ class TestResource(ERP5TypeTestCase): resource.setBaseUnitQuantity(0.001) self.assertEquals(3, resource.getQuantityPrecision()) + def test_defaultSupplyLineAfterClone(self): + """Check that default supply line is properly set up after clone""" + resource = self.portal.getDefaultModule(self.product_portal_type)\ + .newContent(portal_type=self.product_portal_type) + + resource.edit( purchase_supply_line_base_price=1.0, + sale_supply_line_base_price=1.0, + ) + + self.assertEqual( resource, + resource.getDefaultPurchaseSupplyLineValue().getResourceValue() ) + self.assertEqual( resource, + resource.getDefaultSaleSupplyLineValue().getResourceValue() ) + + module = resource.getParentValue() + + cb_data = module.manage_copyObjects(ids=[resource.getId()]) + p_data = module.manage_pasteObjects(cb_data) + + new_resource = module._getOb(p_data[0]['new_id']) + + self.assertEqual( + new_resource, + new_resource.getDefaultPurchaseSupplyLineValue().getResourceValue() + ) + + self.assertEqual( + new_resource, + new_resource.getDefaultSaleSupplyLineValue().getResourceValue() + ) def test_suite(): suite = unittest.TestSuite() -- 2.30.9