Use new property sheet. Change the constraint type to test registration and...

Use new property sheet. Change the constraint type to test registration and override of message because 
the old is not migrated yet


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43424 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9180b754
...@@ -1393,20 +1393,22 @@ class TestConstraint(PropertySheetTestCase): ...@@ -1393,20 +1393,22 @@ class TestConstraint(PropertySheetTestCase):
# constraint are registred in property sheets # constraint are registred in property sheets
obj = self._makeOne() obj = self._makeOne()
obj.setTitle('b') obj.setTitle('b')
self._addPropertySheet(obj.getPortalType(), property_sheet = self._addProperty(
property_sheet_code=\ obj.getPortalType(),
'''class TestPropertySheet: "TestRegisterWithPropertySheet",
_constraints = ( commit=True,
{ 'id': 'testing_constraint', property_id="title_constraint",
'type': 'StringAttributeMatch', portal_type='Attribute Equality Constraint',
'title': 'a.*', },) constraint_attribute_name = 'title',
''') constraint_attribute_value = 'string:a',
)
consistency_message_list = obj.checkConsistency() consistency_message_list = obj.checkConsistency()
self.assertEquals(1, len(consistency_message_list)) self.assertEquals(1, len(consistency_message_list))
message = consistency_message_list[0] message = consistency_message_list[0]
from Products.ERP5Type.ConsistencyMessage import ConsistencyMessage from Products.ERP5Type.ConsistencyMessage import ConsistencyMessage
self.assertTrue(isinstance(message, ConsistencyMessage)) self.assertTrue(isinstance(message, ConsistencyMessage))
self.assertEquals(message.class_name, 'StringAttributeMatch') self.assertEquals(message.class_name, 'Temporary Attribute Equality Constraint')
obj.setTitle('a') obj.setTitle('a')
self.assertEquals(obj.checkConsistency(), []) self.assertEquals(obj.checkConsistency(), [])
...@@ -1414,16 +1416,17 @@ class TestConstraint(PropertySheetTestCase): ...@@ -1414,16 +1416,17 @@ class TestConstraint(PropertySheetTestCase):
# messages can be overriden in property sheet # messages can be overriden in property sheet
obj = self._makeOne() obj = self._makeOne()
obj.setTitle('b') obj.setTitle('b')
self._addPropertySheet(obj.getPortalType(), property_sheet = self._addProperty(
property_sheet_code=\ obj.getPortalType(),
'''class TestPropertySheet: "TestOverrideMessage",
_constraints = ( commit=True,
{ 'id': 'testing_constraint', property_id="title_constraint",
'message_attribute_does_not_match': portal_type='Attribute Equality Constraint',
'Attribute ${attribute_name} does not match', constraint_attribute_name = 'title',
'type': 'StringAttributeMatch', constraint_attribute_value = 'string:a',
'title': 'a.*', },) message_invalid_attribute_value='Attribute ${attribute_name} does not match',
''')
)
consistency_message_list = obj.checkConsistency() consistency_message_list = obj.checkConsistency()
self.assertEquals(1, len(consistency_message_list)) self.assertEquals(1, len(consistency_message_list))
message = consistency_message_list[0] message = consistency_message_list[0]
......
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