From 62ec9a3e8f19734261c9fca84acdfe1bcc165b57 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Wed, 1 Feb 2006 15:20:35 +0000
Subject: [PATCH] Update, because we now validate accounting period as
 activity.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5505 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testAccounting.py | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/product/ERP5/tests/testAccounting.py b/product/ERP5/tests/testAccounting.py
index c5348a2544..acdbc4df69 100755
--- a/product/ERP5/tests/testAccounting.py
+++ b/product/ERP5/tests/testAccounting.py
@@ -39,12 +39,14 @@ os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
 os.environ['EVENT_LOG_SEVERITY'] = '-300'
 
 from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
+from Products.DCWorkflow.DCWorkflow import ValidationFailed
 from AccessControl.SecurityManagement import newSecurityManager
 from zLOG import LOG
 from testPackingList import TestPackingListMixin
 from Products.ERP5Type.tests.Sequence import Sequence, SequenceList
 from DateTime import DateTime
 
+
 class TestAccounting(ERP5TypeTestCase):
   """Test Accounting. """
   
@@ -179,9 +181,16 @@ class TestAccounting(ERP5TypeTestCase):
     accounting_period = sequence.get('accounting_period')
     self.getPortal().portal_workflow.doActionFor(
                         accounting_period,
-                        'deliver_action' )
+                        'close_action' )
+    self.assertEquals(accounting_period.getSimulationState(),
+                      'closing')
+    
+  def stepCheckAccountingPeriodDelivered(self, sequence, **kw):
+    """Check the Accounting Period is delivered."""
+    accounting_period = sequence.get('accounting_period')
     self.assertEquals(accounting_period.getSimulationState(),
                       'delivered')
+    
   
   def stepCreateCurrencies(self, sequence, **kw) :
     """Create a some currencies. """
@@ -387,6 +396,14 @@ class TestAccounting(ERP5TypeTestCase):
     for invoice in invoice_list:
       self.getPortal().portal_workflow.doActionFor(
           invoice, 'stop_action')
+  
+  def stepCheckStopInvoicesRefused(self, sequence, **kw) :
+    """Checks that invoices cannot be validated."""
+    invoice_list = sequence.get('invoice_list')
+    for invoice in invoice_list:
+      self.assertRaises(ValidationFailed,
+          self.getPortal().portal_workflow.doActionFor,
+          invoice, 'stop_action')
 
   def stepCheckInvoicesAreDraft(self, sequence, **kw) :
     """Checks invoices are in draft state."""
@@ -526,6 +543,7 @@ class TestAccounting(ERP5TypeTestCase):
       stepTic
       stepDeliverAccountingPeriod
       stepTic
+      stepCheckAccountingPeriodDelivered
       stepCheckInvoicesAreDelivered
       stepTic
       stepCheckAccountingTransactionDelivered
@@ -544,7 +562,7 @@ class TestAccounting(ERP5TypeTestCase):
       stepTic
       stepUseInvalidDates
       stepCreateInvoices
-      stepStopInvoices
+      stepCheckStopInvoicesRefused
       stepTic
       stepCheckInvoicesAreDraft
     """)
@@ -583,6 +601,7 @@ class TestAccounting(ERP5TypeTestCase):
       stepTic
       stepDeliverAccountingPeriod
       stepTic
+      stepCheckAccountingPeriodDelivered
       stepCheckInvoicesAreDraft
     """)
 
-- 
2.30.9