[Erp5-report] r38511 nicolas - in /erp5/trunk/bt5/erp5_ingestion: SkinTemplateItem/portal_s...

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Sep 21 10:23:17 CEST 2010


Author: nicolas
Date: Tue Sep 21 10:23:16 2010
New Revision: 38511

URL: http://svn.erp5.org?rev=38511&view=rev
Log:
2010-09-21 nicolas
* Add LiveTest instance to check
Ingestion of URLs

Added:
    erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/
    erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test.xml
    erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFile.txt.xml
    erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithFileName.xml
    erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithFileNameAndRedirection.xml
    erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithoutContentType.txt.xml
    erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/text_file.xml
    erp5/trunk/bt5/erp5_ingestion/TestTemplateItem/
    erp5/trunk/bt5/erp5_ingestion/TestTemplateItem/testLiveIngestion.py
Modified:
    erp5/trunk/bt5/erp5_ingestion/bt/change_log
    erp5/trunk/bt5/erp5_ingestion/bt/revision
    erp5/trunk/bt5/erp5_ingestion/bt/template_skin_id_list
    erp5/trunk/bt5/erp5_ingestion/bt/template_test_id_list

Added: erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test.xml?rev=38511&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test.xml (added)
+++ erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test.xml [utf8] Tue Sep 21 10:23:16 2010
@@ -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>

Added: erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFile.txt.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFile.txt.xml?rev=38511&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFile.txt.xml (added)
+++ erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFile.txt.xml [utf8] Tue Sep 21 10:23:16 2010
@@ -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>

Added: erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithFileName.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithFileName.xml?rev=38511&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithFileName.xml (added)
+++ erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithFileName.xml [utf8] Tue Sep 21 10:23:16 2010
@@ -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>

Added: erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithFileNameAndRedirection.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithFileNameAndRedirection.xml?rev=38511&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithFileNameAndRedirection.xml (added)
+++ erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithFileNameAndRedirection.xml [utf8] Tue Sep 21 10:23:16 2010
@@ -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>

Added: erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithoutContentType.txt.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithoutContentType.txt.xml?rev=38511&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithoutContentType.txt.xml (added)
+++ erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/ERP5Site_getTextFileWithoutContentType.txt.xml [utf8] Tue Sep 21 10:23:16 2010
@@ -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>

Added: erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/text_file.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/text_file.xml?rev=38511&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/text_file.xml (added)
+++ erp5/trunk/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion_test/text_file.xml [utf8] Tue Sep 21 10:23:16 2010
@@ -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>

Added: erp5/trunk/bt5/erp5_ingestion/TestTemplateItem/testLiveIngestion.py
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ingestion/TestTemplateItem/testLiveIngestion.py?rev=38511&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_ingestion/TestTemplateItem/testLiveIngestion.py (added)
+++ erp5/trunk/bt5/erp5_ingestion/TestTemplateItem/testLiveIngestion.py [utf8] Tue Sep 21 10:23:16 2010
@@ -0,0 +1,170 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
+#                    Nicolas Delaby <nicolas at 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())

Modified: erp5/trunk/bt5/erp5_ingestion/bt/change_log
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ingestion/bt/change_log?rev=38511&r1=38510&r2=38511&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_ingestion/bt/change_log [utf8] (original)
+++ erp5/trunk/bt5/erp5_ingestion/bt/change_log [utf8] Tue Sep 21 10:23:16 2010
@@ -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.
 

Modified: erp5/trunk/bt5/erp5_ingestion/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ingestion/bt/revision?rev=38511&r1=38510&r2=38511&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_ingestion/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_ingestion/bt/revision [utf8] Tue Sep 21 10:23:16 2010
@@ -1 +1 @@
-109
\ No newline at end of file
+110
\ No newline at end of file

Modified: erp5/trunk/bt5/erp5_ingestion/bt/template_skin_id_list
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ingestion/bt/template_skin_id_list?rev=38511&r1=38510&r2=38511&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_ingestion/bt/template_skin_id_list [utf8] (original)
+++ erp5/trunk/bt5/erp5_ingestion/bt/template_skin_id_list [utf8] Tue Sep 21 10:23:16 2010
@@ -1 +1,2 @@
-erp5_ingestion
\ No newline at end of file
+erp5_ingestion
+erp5_ingestion_test
\ No newline at end of file

Modified: erp5/trunk/bt5/erp5_ingestion/bt/template_test_id_list
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_ingestion/bt/template_test_id_list?rev=38511&r1=38510&r2=38511&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_ingestion/bt/template_test_id_list [utf8] (original)
+++ erp5/trunk/bt5/erp5_ingestion/bt/template_test_id_list [utf8] Tue Sep 21 10:23:16 2010
@@ -0,0 +1 @@
+testLiveIngestion
\ No newline at end of file




More information about the Erp5-report mailing list