[Erp5-report] r43424 fx.algrain - /erp5/trunk/products/ERP5Type/tests/testConstraint.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Feb 17 15:37:34 CET 2011
Author: fx.algrain
Date: Thu Feb 17 15:37:34 2011
New Revision: 43424
URL: http://svn.erp5.org?rev=43424&view=rev
Log:
Use new property sheet. Change the constraint type to test registration and override of message because
the old is not migrated yet
Modified:
erp5/trunk/products/ERP5Type/tests/testConstraint.py
Modified: erp5/trunk/products/ERP5Type/tests/testConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testConstraint.py?rev=43424&r1=43423&r2=43424&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testConstraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testConstraint.py [utf8] Thu Feb 17 15:37:34 2011
@@ -1393,20 +1393,22 @@ class TestConstraint(PropertySheetTestCa
# constraint are registred in property sheets
obj = self._makeOne()
obj.setTitle('b')
- self._addPropertySheet(obj.getPortalType(),
- property_sheet_code=\
- '''class TestPropertySheet:
- _constraints = (
- { 'id': 'testing_constraint',
- 'type': 'StringAttributeMatch',
- 'title': 'a.*', },)
- ''')
+ property_sheet = self._addProperty(
+ obj.getPortalType(),
+ "TestRegisterWithPropertySheet",
+ commit=True,
+ property_id="title_constraint",
+ portal_type='Attribute Equality Constraint',
+ constraint_attribute_name = 'title',
+ constraint_attribute_value = 'string:a',
+ )
+
consistency_message_list = obj.checkConsistency()
self.assertEquals(1, len(consistency_message_list))
message = consistency_message_list[0]
from Products.ERP5Type.ConsistencyMessage import ConsistencyMessage
self.assertTrue(isinstance(message, ConsistencyMessage))
- self.assertEquals(message.class_name, 'StringAttributeMatch')
+ self.assertEquals(message.class_name, 'Temporary Attribute Equality Constraint')
obj.setTitle('a')
self.assertEquals(obj.checkConsistency(), [])
@@ -1414,16 +1416,17 @@ class TestConstraint(PropertySheetTestCa
# messages can be overriden in property sheet
obj = self._makeOne()
obj.setTitle('b')
- self._addPropertySheet(obj.getPortalType(),
- property_sheet_code=\
- '''class TestPropertySheet:
- _constraints = (
- { 'id': 'testing_constraint',
- 'message_attribute_does_not_match':
- 'Attribute ${attribute_name} does not match',
- 'type': 'StringAttributeMatch',
- 'title': 'a.*', },)
- ''')
+ property_sheet = self._addProperty(
+ obj.getPortalType(),
+ "TestOverrideMessage",
+ commit=True,
+ property_id="title_constraint",
+ portal_type='Attribute Equality Constraint',
+ constraint_attribute_name = 'title',
+ constraint_attribute_value = 'string:a',
+ message_invalid_attribute_value='Attribute ${attribute_name} does not match',
+
+ )
consistency_message_list = obj.checkConsistency()
self.assertEquals(1, len(consistency_message_list))
message = consistency_message_list[0]
More information about the Erp5-report
mailing list