[Erp5-report] r13407 - /erp5/trunk/products/ERP5Type/tests/testConstraint.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Mar 13 16:49:31 CET 2007


Author: romain
Date: Tue Mar 13 16:49:30 2007
New Revision: 13407

URL: http://svn.erp5.org?rev=13407&view=rev
Log:
Call setter instead of edit, in order to always modify the property value.

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=13407&r1=13406&r2=13407&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testConstraint.py (original)
+++ erp5/trunk/products/ERP5Type/tests/testConstraint.py Tue Mar 13 16:49:30 2007
@@ -155,7 +155,7 @@
     """
     object = sequence.get('object')
     object_title = self.object_title
-    object.edit(title=object_title)
+    object.setTitle(object_title)
 
   def stepSetObjectNoneTitle(self, sequence=None, 
                              sequence_list=None, **kw):
@@ -163,8 +163,9 @@
       Set a different title value
     """
     object = sequence.get('object')
-    object_title = self.object_title
-    object.edit(title=None)
+    # Do not call edit, as we want to explicitely modify the property
+    # (and edit modify only if value is different)
+    object.setTitle(None)
 
   def stepSetObjectEmptyTitle(self, sequence=None,
                               sequence_list=None, **kw):
@@ -172,8 +173,9 @@
       Set a different title value
     """
     object = sequence.get('object')
-    object_title = self.object_title
-    object.edit(title='')
+    # Do not call edit, as we want to explicitely modify the property
+    # (and edit modify only if value is different)
+    method = object.setTitle('')
 
   def stepSetObjectIntTitle(self, sequence=None,
                             sequence_list=None, **kw):
@@ -251,7 +253,7 @@
   def stepCallRelatedCheckConsistency(self, sequence=None, 
                                       sequence_list=None, **kw):
     """
-      Call checkConsistency of a Constraint.
+    Call checkConsistency of a Constraint.
     """
     object = sequence.get('group')
     constraint = sequence.get('constraint')
@@ -264,20 +266,20 @@
   def stepCheckIfConstraintSucceeded(self, sequence=None, 
                                      sequence_list=None, **kw):
     """
-      Call checkConsistency of a Constraint.
+    Check that checkConsistency returns an empty list
     """
     error_list = sequence.get('error_list')
     self.failIfDifferentSet(error_list, [],
-          "error_list : %s" % error_list)
+          "error_list : %s" % [x.message for x in error_list])
 
   def stepCheckIfConstraintFailed(self, sequence=None, 
                                   sequence_list=None, **kw):
     """
-      Call checkConsistency of a Constraint.
+    Check that checkConsistency does not return an empty list
     """
     error_list = sequence.get('error_list')
     self.failUnless(error_list != [],
-          "error_list : %s" % error_list)
+                    "error_list : %s" % error_list)
 
   def stepCreateConstraint(self, sequence=None, 
                            sequence_list=None, **kw):
@@ -403,14 +405,26 @@
               CheckIfConstraintSucceeded \
               '
     sequence_list.addSequenceString(sequence_string)
+
+    # Test Constraint without title property
+    # on object
+    sequence_string = '\
+              CreateObject \
+              CreatePropertyExistence2 \
+              CallCheckConsistency \
+              CheckIfConstraintFailed \
+              '
+    sequence_list.addSequenceString(sequence_string)
     # Test Constraint with property defined on object
     # With None value
+    # None is considered as a NULL value for string
+    # and so, is considered as a data
     sequence_string = '\
               CreateObject \
               SetObjectNoneTitle \
               CreatePropertyExistence2 \
               CallCheckConsistency \
-              CheckIfConstraintFailed \
+              CheckIfConstraintSucceeded \
               '
     sequence_list.addSequenceString(sequence_string)
     # Test Constraint with property defined on object




More information about the Erp5-report mailing list