[Erp5-report] r13417 - /erp5/trunk/products/ERP5Banking/tests/testERP5BankingCheckPayment.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Mar 14 15:11:40 CET 2007


Author: vincent
Date: Wed Mar 14 15:11:38 2007
New Revision: 13417

URL: http://svn.erp5.org?rev=13417&view=rev
Log:
Add transaction commits between workflow steps to make sure activities are flushed to the activity table and are ready to be found.
Revert previous changes to the CheckConsistency step.
Check payment must be agreggated to a non-existing check for sequence 3 to test what it's meant to.

Modified:
    erp5/trunk/products/ERP5Banking/tests/testERP5BankingCheckPayment.py

Modified: erp5/trunk/products/ERP5Banking/tests/testERP5BankingCheckPayment.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Banking/tests/testERP5BankingCheckPayment.py?rev=13417&r1=13416&r2=13417&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Banking/tests/testERP5BankingCheckPayment.py (original)
+++ erp5/trunk/products/ERP5Banking/tests/testERP5BankingCheckPayment.py Wed Mar 14 15:11:38 2007
@@ -275,16 +275,21 @@
     self.workflow_tool.doActionFor(new_payment, 'plan_action', 
                                    wf_id='check_payment_workflow')
     self.assertEqual(new_payment.getSimulationState(), 'planned')
+    get_transaction().commit()
     if will_fail:
       self.assertRaises(ValidationFailed,self.workflow_tool.doActionFor, 
                         new_payment, 'confirm_action', 
                         wf_id='check_payment_workflow')
+      self.assertEqual(new_payment.getSimulationState(), 'planned')
+      get_transaction().commit()
       self.workflow_tool.doActionFor(new_payment, 'cancel_action', 
                                      wf_id='check_payment_workflow')
     else:
       self.workflow_tool.doActionFor( 
                         new_payment, 'confirm_action', 
                         wf_id='check_payment_workflow')
+      self.assertEqual(new_payment.getSimulationState(), 'confirmed')
+      get_transaction().commit()
       self.workflow_tool.doActionFor(new_payment, 'cancel_action', 
                                      wf_id='check_payment_workflow')
 
@@ -292,40 +297,50 @@
   def stepCheckConsistency(self, sequence=None, sequence_list=None, **kwd):
     """
     Check the consistency of the check payment
-    Enable automatic check creation before passing workflow transition, and
-    disable at the end of the test.
 
     FIXME: check if the transition fails when a category or property is invalid.
+    """
+    self.workflow_tool.doActionFor(self.check_payment, 'plan_action', wf_id='check_payment_workflow')
+    self.assertNotEqual(self.check_payment.getAggregateValue(), None)
+    self.assertEqual(self.check_payment.getSimulationState(), 'planned')
+
+  def stepAggregateToInnexistantCheck(self, sequence=None, sequence_list=None, **kwd):
+    """
+      Set the aggrate relation to direct to an innexistant object, thus
+      requiring the test process to generate one.
+    """
+    self.check_payment.setAggregateFreeText(self.non_existant_check_reference)
+    self.assertEqual(self.check_payment.getAggregateValue(), None)
+
+  def stepTryCheckConsistencyWithoutAutomaticCheckCreation(self, sequence=None, sequence_list=None, **kwd):
+    """
+      Do not enable automatic check creation and verify that validation fails.
+    """
+    self.assertFalse(self.getPortal().Base_isAutomaticCheckCreationAllowed())
+    self.assertEqual(self.check_payment.getAggregateValue(), None)
+    self.assertNotEqual(self.check_payment.getSimulationState(), 'planned')
+
+    self.assertRaises(ValidationFailed, self.workflow_tool.doActionFor, self.check_payment, 'plan_action', wf_id='check_payment_workflow')
+
+    self.assertEqual(self.check_payment.getAggregateValue(), None)
+    self.assertNotEqual(self.check_payment.getSimulationState(), 'planned')
+
+  def stepTryCheckConsistencyWithAutomaticCheckCreation(self, sequence=None, sequence_list=None, **kwd):
+    """
+      Enable automatic check creation and verify that validation succeeds.
     """
     check_creation_script = self.getPortal().Base_isAutomaticCheckCreationAllowed
     original_script_source = check_creation_script._body
     check_creation_script.ZPythonScript_edit(check_creation_script._params, 'return True')
     self.assertTrue(self.getPortal().Base_isAutomaticCheckCreationAllowed())
+    self.assertEqual(self.check_payment.getAggregateValue(), None)
+    self.assertNotEqual(self.check_payment.getSimulationState(), 'planned')
+
     self.workflow_tool.doActionFor(self.check_payment, 'plan_action', wf_id='check_payment_workflow')
+
     self.assertNotEqual(self.check_payment.getAggregateValue(), None)
     self.assertEqual(self.check_payment.getSimulationState(), 'planned')
     check_creation_script.ZPythonScript_edit(check_creation_script._params, original_script_source)
-
-  def stepAggregateToInnexistantCheck(self, sequence=None, sequence_list=None, **kwd):
-    """
-      Set the aggrate relation to direct to an innexistant object, thus
-      requiring the test process to generate one.
-    """
-    self.check_payment.setAggregateFreeText(self.non_existant_check_reference)
-    self.assertEqual(self.check_payment.getAggregateValue(), None)
-
-  def stepTryCheckConsistencyWithoutAutomaticCheckCreation(self, sequence=None, sequence_list=None, **kwd):
-    """
-      Do not enable automatic check creation and verify that validation fails.
-    """
-    self.assertFalse(self.getPortal().Base_isAutomaticCheckCreationAllowed())
-    self.assertEqual(self.check_payment.getAggregateValue(), None)
-    self.assertNotEqual(self.check_payment.getSimulationState(), 'planned')
-
-    self.assertRaises(ValidationFailed, self.workflow_tool.doActionFor, self.check_payment, 'plan_action', wf_id='check_payment_workflow')
-
-    self.assertEqual(self.check_payment.getAggregateValue(), None)
-    self.assertNotEqual(self.check_payment.getSimulationState(), 'planned')
 
   def stepSendToCounter(self, sequence=None, sequence_list=None, **kwd):
     """
@@ -450,7 +465,8 @@
     # automatic check creation is enabled.
     sequence_string_3 = 'Tic CheckObjects Tic CheckInitialInventory ' \
                         'CreateCheckPayment Tic ' \
-                        'CheckConsistency Tic ' \
+                        'AggregateToInnexistantCheck Tic ' \
+                        'TryCheckConsistencyWithAutomaticCheckCreation Tic ' \
                         'Cleanup Tic'
     sequence_list.addSequenceString(sequence_string)
     sequence_list.addSequenceString(sequence_string_2)




More information about the Erp5-report mailing list