[Erp5-report] r7301 - /erp5/trunk/products/ERP5/tests/testInvoice.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue May 16 20:29:09 CEST 2006


Author: alex
Date: Tue May 16 20:29:06 2006
New Revision: 7301

URL: http://svn.erp5.org?rev=7301&view=rev
Log:
Added test with invoice start_date change

Modified:
    erp5/trunk/products/ERP5/tests/testInvoice.py

Modified: erp5/trunk/products/ERP5/tests/testInvoice.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testInvoice.py?rev=7301&r1=7300&r2=7301&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testInvoice.py (original)
+++ erp5/trunk/products/ERP5/tests/testInvoice.py Tue May 16 20:29:06 2006
@@ -669,6 +669,13 @@
         portal_type=self.invoice_line_portal_type):
       invoice_line.edit(quantity=quantity)
 
+  def stepChangeInvoiceStartDate(self, sequence=None, sequence_list=None, **kw):
+    """
+      Change the start_date of the invoice.
+    """
+    invoice = sequence.get('invoice')
+    invoice.edit(start_date=self.datetime + 15)
+
   def stepCheckInvoiceIsCalculating(self, sequence=None, sequence_list=None,
       **kw):
     """
@@ -718,6 +725,14 @@
     invoice.portal_workflow.doActionFor(invoice,'split_prevision_action',
         wf_id='invoice_causality_workflow', start_date=self.datetime +
         15, stop_date=self.datetime + 25)
+
+  def stepAcceptDecisionInvoice(self, sequence=None, sequence_list=None,
+      **kw):
+    """
+    accept decision at the invoice level
+    """
+    invoice = sequence.get('invoice')
+    invoice.portal_workflow.doActionFor(invoice,'accept_decision_action')
 
   def stepCheckInvoiceSplitted(self, sequence=None, sequence_list=None, **kw):
     """
@@ -742,9 +757,21 @@
           portal_type=self.invoice_line_portal_type):
       self.assertEquals(1,line.getQuantity())
 
-
-
-
+  def stepCheckInvoiceNotSplitted(self, sequence=None, sequence_list=None, **kw):
+    """
+    Test if invoice was not splitted
+    """
+    packing_list = sequence.get('packing_list')
+    invoice_list = packing_list.getCausalityRelatedValueList(
+        portal_type=self.invoice_portal_type)
+    self.assertEquals(1,len(invoice_list))
+    invoice1 = None
+    for invoice in invoice_list:
+      if invoice.getUid() == sequence.get('invoice').getUid():
+        invoice1 = invoice
+    for line in invoice1.objectValues(
+        portal_type=self.invoice_line_portal_type):
+      self.assertEquals(self.default_quantity, line.getQuantity())
 
   # default sequence for one line of not varianted resource.
   PACKING_LIST_DEFAULT_SEQUENCE = """
@@ -986,8 +1013,7 @@
       stepRebuildAndCheckNothingIsCreated
     """)
 
-  #def test_08_InvoiceDecreaseQuantity(self, quiet=0, run=RUN_ALL_TESTS):
-  def test_08_InvoiceDecreaseQuantity(self, quiet=0, run=1):
+  def test_08_InvoiceDecreaseQuantity(self, quiet=0, run=RUN_ALL_TESTS):
     """Change the quantity of a Invoice Line,
     check that the packing list is divergent,
     then split and differ"""
@@ -1014,6 +1040,34 @@
     """
     self.playSequence(sequence)
     
+  def test_09_InvoiceChangeStartDate(self, quiet=0, run=RUN_ALL_TESTS):
+    """Change the start_date of a Invoice Line,
+    check that the packing list is divergent,
+    then acceptDecision"""
+    if not run: return
+    sequence = self.PACKING_LIST_DEFAULT_SEQUENCE + \
+    """
+    stepSetReadyPackingList
+    stepTic
+    stepStartPackingList
+    stepCheckInvoicingRule
+    stepTic
+    stepCheckInvoiceBuilding
+
+    stepChangeInvoiceStartDate
+    stepCheckInvoiceIsCalculating
+    stepAcceptDecisionInvoice
+    stepTic
+    stepCheckInvoiceIsSolved
+    stepCheckInvoiceNotSplitted
+    stepCheckPackingListIsDivergent
+    stepCheckPackingListIsDiverged
+    stepCheckSimulationStartDateUpdated
+
+    stepRebuildAndCheckNothingIsCreated
+    """
+    self.playSequence(sequence)
+    
 if __name__ == '__main__':
   framework()
 else:




More information about the Erp5-report mailing list