Commit 95349249 authored by Romain Courteaud's avatar Romain Courteaud

Associate the constraint's propertysheet of Inventory, as it is not associated

by default anymore.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20486 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent dbf20ffa
......@@ -44,6 +44,7 @@ from Products.ERP5.Document.OrderRule import OrderRule
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import reindex
from Products.DCWorkflow.DCWorkflow import ValidationFailed
from Products.ERP5Type.Base import _aq_reset
class InventoryAPITestCase(ERP5TypeTestCase):
"""Base class for Inventory API Tests {{{
......@@ -2010,6 +2011,17 @@ class TestInventoryDocument(InventoryAPITestCase):
does not allow such things
"""
portal = self.getPortal()
portal_type_name = 'Inventory'
property_sheet_name = 'InventoryConstraint'
# We set the property sheet on the portal type
ti = self.getTypesTool().getTypeInfo(portal_type_name)
ti.property_sheet_list = list(ti.property_sheet_list) +\
[property_sheet_name]
# reset aq_dynamic cache
_aq_reset()
try:
inventory_module = portal.getDefaultModule(portal_type='Inventory')
inventory = inventory_module.newContent(portal_type='Inventory')
date = self.DUPLICATE_INVENTORY_DATE
......@@ -2055,6 +2067,19 @@ class TestInventoryDocument(InventoryAPITestCase):
name='history', wf_id=workflow_id)
workflow_error_message = str(workflow_history[-1]['error_message'])
self.assertTrue(workflow_error_message.find('There is already an inventory')>=0)
finally:
# remove all property sheet we added to type informations
ttool = self.getTypesTool()
ti = ttool.getTypeInfo(portal_type_name)
ps_list = ti.property_sheet_list
psheet_list = [property_sheet_name]
for psheet in psheet_list:
if psheet in ps_list:
ps_list.remove(psheet)
ti.property_sheet_list = ps_list
get_transaction().commit()
_aq_reset()
def test_suite():
suite = unittest.TestSuite()
......
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