From b171c5047d39ba0466a6ebd16d6b16ff5a48d850 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Tue, 21 Sep 2010 08:23:16 +0000
Subject: [PATCH] 2010-09-21 nicolas * Add LiveTest instance to check Ingestion
 of URLs

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38511 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../portal_skins/erp5_ingestion_test.xml      |  26 +++
 .../ERP5Site_getTextFile.txt.xml              | 125 +++++++++++++
 .../ERP5Site_getTextFileWithFileName.xml      | 127 +++++++++++++
 ..._getTextFileWithFileNameAndRedirection.xml | 132 ++++++++++++++
 ...Site_getTextFileWithoutContentType.txt.xml | 124 +++++++++++++
 .../erp5_ingestion_test/text_file.xml         |  42 +++++
 .../TestTemplateItem/testLiveIngestion.py     | 170 ++++++++++++++++++
 bt5/erp5_ingestion/bt/change_log              |   4 +
 bt5/erp5_ingestion/bt/revision                |   2 +-
 bt5/erp5_ingestion/bt/template_skin_id_list   |   3 +-
 bt5/erp5_ingestion/bt/template_test_id_list   |   1 +
 11 files changed, 754 insertions(+), 2 deletions(-)
 create mode 100644 bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test.xml
 create mode 100644 bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFile.txt.xml
 create mode 100644 bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithFileName.xml
 create mode 100644 bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithFileNameAndRedirection.xml
 create mode 100644 bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithoutContentType.txt.xml
 create mode 100644 bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/text_file.xml
 create mode 100644 bt5/erp5_ingestion/TestTemplateItem/testLiveIngestion.py

diff --git a/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test.xml b/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test.xml
new file mode 100644
index 0000000000..b35f108170
--- /dev/null
+++ b/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="Folder" module="OFS.Folder"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_objects</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>erp5_ingestion_test</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFile.txt.xml b/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFile.txt.xml
new file mode 100644
index 0000000000..7d0fbeb131
--- /dev/null
+++ b/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFile.txt.xml
@@ -0,0 +1,125 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <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_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <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>_body</string> </key>
+            <value> <string>document = context.text_file\n
+context.REQUEST.RESPONSE.setHeader(\'content-type\', \'text/plain\')\n
+return document.data\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>seed=None</string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>1</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>seed</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>document</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <tuple>
+                <none/>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>ERP5Site_getTextFile.txt</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithFileName.xml b/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithFileName.xml
new file mode 100644
index 0000000000..9f71a691c4
--- /dev/null
+++ b/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithFileName.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <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_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <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>_body</string> </key>
+            <value> <string>document = context.text_file\n
+context.REQUEST.RESPONSE.setHeader(\'content-type\', \'text/plain\')\n
+context.REQUEST.RESPONSE.setHeader(\'content-disposition\', \'attachment; filename="%s"\' % filename)\n
+return document.data\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>filename, seed=None</string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>2</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>filename</string>
+                            <string>seed</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>document</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <tuple>
+                <none/>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>ERP5Site_getTextFileWithFileName</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithFileNameAndRedirection.xml b/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithFileNameAndRedirection.xml
new file mode 100644
index 0000000000..c7e74251fb
--- /dev/null
+++ b/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithFileNameAndRedirection.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <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_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <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>_body</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+portal = context.getPortalObject()\n
+context.REQUEST.RESPONSE.setHeader(\'content-type\', \'text/plain\')\n
+context.REQUEST.RESPONSE.setHeader(\'Location\', \'%s/ERP5Site_getTextFileWithFileName?filename=%s&seed=%s\' % (portal.absolute_url(), filename, seed))\n
+context.REQUEST.RESPONSE.setStatus(302)\n
+return \'\'\n
+
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>filename, seed=None</string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>2</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>filename</string>
+                            <string>seed</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>portal</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <tuple>
+                <none/>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>ERP5Site_getTextFileWithFileNameAndRedirection</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithoutContentType.txt.xml b/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithoutContentType.txt.xml
new file mode 100644
index 0000000000..476a364dc6
--- /dev/null
+++ b/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithoutContentType.txt.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <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_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <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>_body</string> </key>
+            <value> <string>document = context.text_file\n
+return document.data\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>seed=None</string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>1</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>seed</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>document</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <tuple>
+                <none/>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>ERP5Site_getTextFileWithoutContentType.txt</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/text_file.xml b/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/text_file.xml
new file mode 100644
index 0000000000..b4ca0ead67
--- /dev/null
+++ b/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/text_file.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="File" module="OFS.Image"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_EtagSupport__etag</string> </key>
+            <value> <string>ts84467571.86</string> </value>
+        </item>
+        <item>
+            <key> <string>__name__</string> </key>
+            <value> <string>text_file</string> </value>
+        </item>
+        <item>
+            <key> <string>content_type</string> </key>
+            <value> <string>text/plain</string> </value>
+        </item>
+        <item>
+            <key> <string>data</string> </key>
+            <value> <string>This is a very interesting document. It contains something special, namely a magic keyword. It also has an embedded meta information: function:musician/wind/saxophone\n
+\n
+\x0c</string> </value>
+        </item>
+        <item>
+            <key> <string>precondition</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>size</string> </key>
+            <value> <int>169</int> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_ingestion/TestTemplateItem/testLiveIngestion.py b/bt5/erp5_ingestion/TestTemplateItem/testLiveIngestion.py
new file mode 100644
index 0000000000..565b238d36
--- /dev/null
+++ b/bt5/erp5_ingestion/TestTemplateItem/testLiveIngestion.py
@@ -0,0 +1,170 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
+#                    Nicolas Delaby <nicolas@erp5.org>
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+##############################################################################
+
+import unittest
+import os
+
+from Products.ERP5Type.tests.ERP5TypeTestCase import _getConversionServerDict
+from Products.ERP5Type.tests.ERP5TypeLiveTestCase import ERP5TypeLiveTestCase
+from zLOG import LOG, INFO, ERROR
+from Products.CMFCore.utils import getToolByName
+import transaction
+import random
+import string
+
+# test files' home
+FILE_NAME_REGULAR_EXPRESSION = "(?P<reference>[A-Z&é@{]{3,7})-(?P<language>[a-z]{2})-(?P<version>[0-9]{3})"
+REFERENCE_REGULAR_EXPRESSION = "(?P<reference>[A-Z&é@{]{3,7})(-(?P<language>[a-z]{2}))?(-(?P<version>[0-9]{3}))?"
+
+class TestIngestion(ERP5TypeLiveTestCase):
+  """
+    ERP5 Document Management System - test url ingestion mechanism
+  """
+
+  _path_to_delete_list = []
+
+  def getTitle(self):
+    """
+      Return the title of the current test set.
+    """
+    return "ERP5 Live DMS - URL Ingestion"
+
+  def getBusinessTemplateList(self):
+    """
+      Return the list of required business templates.
+    """
+    return ('erp5_base',
+            'erp5_ingestion',
+            'erp5_ingestion_mysql_innodb_catalog',
+            'erp5_web',
+            'erp5_crm',
+            'erp5_dms')
+
+  def afterSetUp(self):
+    """
+      Initialize the ERP5 site.
+    """
+    self.login()
+    self.portal = self.getPortal()
+    self.setSystemPreference()
+
+  def beforeTearDown(self):
+    portal = self.portal
+    # delete created documents by test
+    for path in self._path_to_delete_list:
+      document = portal.unrestrictedTraverse(path, None)
+      if document is None:
+        continue
+      doucument_id = document.getId()
+      document_parent = document.getParentValue()
+      document_parent._delObject(doucument_id)
+    # Unindex deleted documents
+    transaction.commit()
+    self.tic()
+
+  def setSystemPreference(self):
+    portal_preferences = getToolByName(self.portal, 'portal_preferences')
+    default_pref = portal_preferences.default_site_preference
+    conversion_dict = _getConversionServerDict()
+    default_pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
+    default_pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
+    default_pref.setPreferredDocumentFileNameRegularExpression(FILE_NAME_REGULAR_EXPRESSION)
+    default_pref.setPreferredDocumentReferenceRegularExpression(REFERENCE_REGULAR_EXPRESSION)
+    if default_pref.getPreferenceState() != 'global':
+      default_pref.enable()
+
+  def contributeFileWithUrl(self, script_id, filename=None):
+    """compute url and call portal_contributions.newContentFromUrl
+    """
+    portal = self.portal
+    contribution_tool = getToolByName(portal, 'portal_contributions')
+    # seed parameter is here to ensure entropy for document id generation
+    seed = ''.join([random.choice(string.ascii_letters) for i in xrange(20)])
+    url = portal.absolute_url()
+    url += '/%s?seed=%s' % (script_id, seed)
+    if filename:
+      url += '&filename=%s' % filename
+    document = contribution_tool.newContentFromURL(url=url)
+    self._path_to_delete_list.append(document.getPath())
+    return document
+
+  def test_01_contributeTextFileWithFilenamefromUrl(self):
+    """
+      Contribute file with filename
+    """
+    script_id = 'ERP5Site_getTextFileWithFileName'
+    filename = 'any_file.txt'
+    document = self.contributeFileWithUrl(script_id, filename=filename)
+    transaction.commit()
+    self.tic()
+    self.assertEquals(document.getPortalType(), 'Text')
+    self.assertEquals(document.getSourceReference(), filename)
+    self.assertEquals(document.getContentType(), 'text/plain')
+    self.assertTrue(document.hasData())
+
+  def test_02_contributeTextFileWithExplicitExtensionfromUrl(self):
+    """
+      Contribute file without filename but explicit extension
+      in URL
+    """
+    script_id = 'ERP5Site_getTextFile.txt'
+    document = self.contributeFileWithUrl(script_id)
+    transaction.commit()
+    self.tic()
+    self.assertEquals(document.getPortalType(), 'Text')
+    self.assertEquals(document.getSourceReference(), script_id)
+    self.assertEquals(document.getContentType(), 'text/plain')
+    self.assertTrue(document.hasData())
+
+  def test_03_textFileWithExplicitExtensionWithoutContentTypefromUrl(self):
+    """
+      Contribute file with explicit extension without content-type
+    """
+    script_id = 'ERP5Site_getTextFileWithoutContentType.txt'
+    document = self.contributeFileWithUrl(script_id)
+    transaction.commit()
+    self.tic()
+    self.assertEquals(document.getPortalType(), 'Text')
+    self.assertEquals(document.getSourceReference(), script_id)
+    self.assertEquals(document.getContentType(), 'text/plain')
+    self.assertTrue(document.hasData())
+
+  def test_04_contributeTextFileWithFilenameAndRedirectionfromUrl(self):
+    """
+      Contribute file with url which redirect to another location
+    """
+    script_id = 'ERP5Site_getTextFileWithFileNameAndRedirection'
+    filename = 'any_file.txt'
+    document = self.contributeFileWithUrl(script_id, filename=filename)
+    transaction.commit()
+    self.tic()
+    self.assertEquals(document.getPortalType(), 'Text')
+    self.assertEquals(document.getSourceReference(), filename)
+    self.assertEquals(document.getContentType(), 'text/plain')
+    self.assertTrue(document.hasData())
diff --git a/bt5/erp5_ingestion/bt/change_log b/bt5/erp5_ingestion/bt/change_log
index fe2f031ac3..097a70b099 100644
--- a/bt5/erp5_ingestion/bt/change_log
+++ b/bt5/erp5_ingestion/bt/change_log
@@ -1,3 +1,7 @@
+2010-09-21 nicolas
+* Add LiveTest instance to check
+Ingestion of URLs
+
 2009-10-16 rafael
 * Update for the changes of new portal types of portal types.
 
diff --git a/bt5/erp5_ingestion/bt/revision b/bt5/erp5_ingestion/bt/revision
index 6d58c4e590..97e3504110 100644
--- a/bt5/erp5_ingestion/bt/revision
+++ b/bt5/erp5_ingestion/bt/revision
@@ -1 +1 @@
-109
\ No newline at end of file
+110
\ No newline at end of file
diff --git a/bt5/erp5_ingestion/bt/template_skin_id_list b/bt5/erp5_ingestion/bt/template_skin_id_list
index 84fd43167e..588ee38811 100644
--- a/bt5/erp5_ingestion/bt/template_skin_id_list
+++ b/bt5/erp5_ingestion/bt/template_skin_id_list
@@ -1 +1,2 @@
-erp5_ingestion
\ No newline at end of file
+erp5_ingestion
+erp5_ingestion_test
\ No newline at end of file
diff --git a/bt5/erp5_ingestion/bt/template_test_id_list b/bt5/erp5_ingestion/bt/template_test_id_list
index e69de29bb2..d41ad491cb 100644
--- a/bt5/erp5_ingestion/bt/template_test_id_list
+++ b/bt5/erp5_ingestion/bt/template_test_id_list
@@ -0,0 +1 @@
+testLiveIngestion
\ No newline at end of file
-- 
2.30.9