From cfb725f995a28e547725e9f6460e45b0365506af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Mon, 22 Jun 2009 15:45:05 +0000
Subject: [PATCH] update tests for reversal transaction creation, and add test
 for multiple reversal transaction creation from the module

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27753 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 ...nting_transaction_create_reversal.html.xml |   5 +
 ...ransaction_module_create_reversal.html.xml | 162 ++++++++++++++++++
 ...voice_transaction_create_reversal.html.xml |   5 +
 ...voice_transaction_create_reversal.html.xml |   5 +
 ...gZuite_createAccountingTransactionList.xml |  18 +-
 bt5/erp5_accounting_ui_test/bt/revision       |   2 +-
 6 files changed, 195 insertions(+), 2 deletions(-)
 create mode 100644 bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/accounting_transaction_zuite/test_accounting_transaction_module_create_reversal.html.xml

diff --git a/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/accounting_transaction_zuite/test_accounting_transaction_create_reversal.html.xml b/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/accounting_transaction_zuite/test_accounting_transaction_create_reversal.html.xml
index 9375e70990..235abc9360 100644
--- a/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/accounting_transaction_zuite/test_accounting_transaction_create_reversal.html.xml
+++ b/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/accounting_transaction_zuite/test_accounting_transaction_create_reversal.html.xml
@@ -205,6 +205,11 @@ delivered.\n
   <td>select_action</td>\n
   <td>Create Reversal Transaction</td>\n
 </tr>\n
+<tr>\n
+  <td>clickAndWait</td>\n
+  <td>Base_callDialogMethod:method</td>\n
+  <td></td>\n
+</tr>\n
 <tr>\n
   <td>assertPortalStatusMessage</td>\n
   <td>Reversal Transaction for * created.</td>\n
diff --git a/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/accounting_transaction_zuite/test_accounting_transaction_module_create_reversal.html.xml b/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/accounting_transaction_zuite/test_accounting_transaction_module_create_reversal.html.xml
new file mode 100644
index 0000000000..ddee404bba
--- /dev/null
+++ b/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/accounting_transaction_zuite/test_accounting_transaction_module_create_reversal.html.xml
@@ -0,0 +1,162 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+<html>\n
+<head><title>Test for Creating reversal of multiple transactions</title></head>\n
+<body>\n
+<table cellpadding="1" cellspacing="1" border="1">\n
+<thead>\n
+<tr><td rowspan="1" colspan="4">\n
+Test for Creating reversal of multiple transactions\n
+</td></tr>\n
+</thead><tbody tal:define="init_method string:AccountingZuite_createAccountingTransactionList?add_draft_transactions:int=0&amp;transaction_state=delivered">\n
+<tal:block metal:use-macro="here/AccountingZuite_CommonTemplate/macros/init"/>\n
+\n
+<!-- Setup {{{ -->\n
+<tr>\n
+  <td>open</td>\n
+  <td>${base_url}/AccountingZuite_markChanged</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>verifyTextPresent</td>\n
+  <td>Done.</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>open</td>\n
+  <td>${base_url}</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>selectAndWait</td>\n
+  <td>select_module</td>\n
+  <td>Accounting</td>\n
+</tr>\n
+<!-- }}} -->\n
+\n
+<!-- Select All {{{ -->\n
+<tr>\n
+  <td>clickAndWait</td>\n
+  <td>//button[@title=\'Show All\']</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>verifyText</td>\n
+  <td>listbox_record_number</td>\n
+  <td>4 record(s)</td>\n
+</tr>\n
+<!-- }}} -->\n
+\n
+<!-- select create reversal action {{{ -->\n
+<tr>\n
+  <td>selectAndWait</td>\n
+  <td>select_action</td>\n
+  <td>Create Reversal Transactions</td>\n
+</tr>\n
+<tr>\n
+  <td>clickAndWait</td>\n
+  <td>Base_callDialogMethod:method</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>assertPortalStatusMessage</td>\n
+  <td>Reversal creation for 4 on 4 transactions in progress.</td>\n
+  <td></td>\n
+</tr>\n
+<!-- }}} -->\n
+\n
+<!-- Check accounting transactions are created {{{ -->\n
+<tr>\n
+  <td>open</td>\n
+  <td>${base_url}/Zuite_waitForActivities</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>assertTextPresent</td>\n
+  <td>Done.</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>open</td>\n
+  <td>${base_url}/accounting_module/view</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>clickAndWait</td>\n
+  <td>//button[@title=\'Show All\']</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>verifyText</td>\n
+  <td>listbox_record_number</td>\n
+  <td>8 record(s)</td>\n
+</tr>\n
+<!-- }}} -->\n
+\n
+</tbody></table>\n
+</body>\n
+</html> <!-- vim: syntax=html foldmethod=marker\n
+-->\n
+
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>content_type</string> </key>
+            <value> <string>text/html</string> </value>
+        </item>
+        <item>
+            <key> <string>expand</string> </key>
+            <value> <int>0</int> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>test_accounting_transaction_module_create_reversal.html</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/accounting_transaction_zuite/test_purchase_invoice_transaction_create_reversal.html.xml b/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/accounting_transaction_zuite/test_purchase_invoice_transaction_create_reversal.html.xml
index 1487cdcfbc..dfae11da26 100644
--- a/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/accounting_transaction_zuite/test_purchase_invoice_transaction_create_reversal.html.xml
+++ b/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/accounting_transaction_zuite/test_purchase_invoice_transaction_create_reversal.html.xml
@@ -221,6 +221,11 @@ delivered.\n
   <td>select_action</td>\n
   <td>Create Reversal Transaction</td>\n
 </tr>\n
+<tr>\n
+  <td>clickAndWait</td>\n
+  <td>Base_callDialogMethod:method</td>\n
+  <td></td>\n
+</tr>\n
 <tr>\n
   <td>assertPortalStatusMessage</td>\n
   <td>Reversal Transaction for * created.</td>\n
diff --git a/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/accounting_transaction_zuite/test_sale_invoice_transaction_create_reversal.html.xml b/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/accounting_transaction_zuite/test_sale_invoice_transaction_create_reversal.html.xml
index 6c44367e11..eff1add5fb 100644
--- a/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/accounting_transaction_zuite/test_sale_invoice_transaction_create_reversal.html.xml
+++ b/bt5/erp5_accounting_ui_test/PathTemplateItem/portal_tests/accounting_zuite/accounting_transaction_zuite/test_sale_invoice_transaction_create_reversal.html.xml
@@ -223,6 +223,11 @@ delivered.\n
   <td>select_action</td>\n
   <td>Create Reversal Transaction</td>\n
 </tr>\n
+<tr>\n
+  <td>clickAndWait</td>\n
+  <td>Base_callDialogMethod:method</td>\n
+  <td></td>\n
+</tr> \n
 <tr>\n
   <td>assertPortalStatusMessage</td>\n
   <td>Reversal Transaction for * created.</td>\n
diff --git a/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createAccountingTransactionList.xml b/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createAccountingTransactionList.xml
index 576d4962d4..01e4641cf1 100644
--- a/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createAccountingTransactionList.xml
+++ b/bt5/erp5_accounting_ui_test/SkinTemplateItem/portal_skins/erp5_accounting_ui_test/AccountingZuite_createAccountingTransactionList.xml
@@ -184,9 +184,14 @@ for month in range(1, month_count + 1):\n
                 immediate_reindex=immediate_reindex,\n
                 source=getAccountByTitle(\'Stocks\'),\n
                 quantity=-5000)\n
+  # TODO: "validated" should be renamed to "stopped"\n
   if transaction_state == \'validated\':\n
     tr.stop()\n
     assert tr.getSimulationState() == \'stopped\'\n
+  elif transaction_state == \'delivered\':\n
+    tr.stop()\n
+    tr.deliver()\n
+    assert tr.getSimulationState() == \'delivered\'\n
   else:\n
     # other cases not supported for now\n
     assert transaction_state == \'draft\'\n
@@ -238,6 +243,10 @@ for month in range(1, month_count + 1):\n
     if transaction_state == \'validated\':\n
       tr.stop()\n
       assert tr.getSimulationState() == \'stopped\'\n
+    elif transaction_state == \'delivered\':\n
+      tr.stop()\n
+      tr.deliver()\n
+      assert tr.getSimulationState() == \'delivered\'\n
     else:\n
       # other cases not supported for now\n
       assert transaction_state == \'draft\'\n
@@ -262,9 +271,12 @@ for month in range(1, month_count + 1):\n
                     immediate_reindex=immediate_reindex,\n
                     source=getAccountByTitle(\'Receivable\'),\n
                     quantity=(amount * (1 + vat_rate)))\n
-      if transaction_state == \'validated\':\n
+      if transaction_state in (\'validated\', \'delivered\'):\n
         payment.stop()\n
         assert payment.getSimulationState() == \'stopped\'\n
+        if transaction_state == \'delivered\':\n
+          tr.deliver()\n
+          assert tr.getSimulationState() == \'delivered\'\n
         if not keep_grouping_reference:\n
           for line in payment.getMovementList(\n
                           portal_type=payment.getPortalAccountingMovementTypeList()):\n
@@ -307,6 +319,10 @@ for month in range(1, month_count + 1):\n
   if transaction_state == \'validated\':\n
     tr.stop()\n
     assert tr.getSimulationState() == \'stopped\'\n
+  elif transaction_state == \'delivered\':\n
+    tr.stop()\n
+    tr.deliver()\n
+    assert tr.getSimulationState() == \'delivered\'\n
   else:\n
     # other cases not supported for now\n
     assert transaction_state == \'draft\'\n
diff --git a/bt5/erp5_accounting_ui_test/bt/revision b/bt5/erp5_accounting_ui_test/bt/revision
index 405e057083..b854a29217 100644
--- a/bt5/erp5_accounting_ui_test/bt/revision
+++ b/bt5/erp5_accounting_ui_test/bt/revision
@@ -1 +1 @@
-127
\ No newline at end of file
+128
\ No newline at end of file
-- 
2.30.9