From 11ec803feb21b386a9eef0b56a4eb6885e2c4d70 Mon Sep 17 00:00:00 2001 From: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Tue, 28 Sep 2010 13:31:37 +0000 Subject: [PATCH] check if ingested File document works fine with SearchableText() method, that currently fails for XML ingestion. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38720 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5OOo/tests/testIngestion.py | 25 +++++++++++++++++++ .../tests/test_document/TEST-en-002.rss | 23 +++++++++++++++++ .../tests/test_document/TEST-en-002.xml | 23 +++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 product/ERP5OOo/tests/test_document/TEST-en-002.rss create mode 100644 product/ERP5OOo/tests/test_document/TEST-en-002.xml diff --git a/product/ERP5OOo/tests/testIngestion.py b/product/ERP5OOo/tests/testIngestion.py index f1c5f9e6f9..27f50fb8fc 100644 --- a/product/ERP5OOo/tests/testIngestion.py +++ b/product/ERP5OOo/tests/testIngestion.py @@ -290,6 +290,9 @@ class TestIngestion(ERP5TypeTestCase): self.assertEquals(document.getExternalProcessingState(), 'converted') self.assert_('magic' in document.SearchableText()) self.assert_('magic' in str(document.asText())) + else: + # check if SearchableText() does not raise any exception + document.SearchableText() def checkDocumentExportList(self, document_id, format, asserted_target_list): """ @@ -470,6 +473,13 @@ class TestIngestion(ERP5TypeTestCase): """ self.newEmptyCataloggedDocument('Image', 'six') + def stepCreateFileDocument(self, sequence=None, sequence_list=None, **kw): + """ + Create an empty File document with ID 'file' + This document will be used in most tests. + """ + self.newEmptyCataloggedDocument('File', 'file') + def stepCheckEmptyState(self, sequence=None, sequence_list=None, **kw): """ Check if the document is in "empty" processing state @@ -731,6 +741,13 @@ class TestIngestion(ERP5TypeTestCase): format_list = ['jpg', 'gif', 'bmp', 'png'] self.ingestFormatList('six', format_list, 'Image') + def stepIngestFileFormats(self, sequence=None, sequence_list=None, **kw): + """ + ingest all supported file formats + """ + format_list = ['txt', 'rss', 'xml',] + self.ingestFormatList('file', format_list) + def stepCheckTextDocumentExportList(self, sequence=None, sequence_list=None, **kw): self.checkDocumentExportList('one', 'doc', ['pdf', 'doc', 'rtf', 'writer.html', 'txt']) @@ -1135,6 +1152,14 @@ class TestIngestion(ERP5TypeTestCase): ] self.playSequence(step_list, quiet) + def test_05_FormatIngestionFile(self, quiet=QUIET, run=RUN_ALL_TEST): + if not run: return + if not quiet: printAndLog('test_05_FormatIngestion') + step_list = ['stepCleanUp' + ,'stepCreateFileDocument' + ,'stepIngestFileFormats' + ] + self.playSequence(step_list, quiet) # Test generation of files in all possible formats # which means check if they have correct lists of available formats for export diff --git a/product/ERP5OOo/tests/test_document/TEST-en-002.rss b/product/ERP5OOo/tests/test_document/TEST-en-002.rss new file mode 100644 index 0000000000..3bdabcfdd7 --- /dev/null +++ b/product/ERP5OOo/tests/test_document/TEST-en-002.rss @@ -0,0 +1,23 @@ +<?xml version="1.0"?> +<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" version="2.0"> + <channel> + <atom:link rel="self" type="application/rss+xml" href="http://example.com/WebSection_viewContentListAsRSS"/> + <title>example.com</title> + <link>http://example.com</link> + <description/> + <item> + <guid>http://example.com/document_module/2</guid> + <link>http://example.com/document_module/2</link> + <description/> + <pubDate>Mon, 27 Sep 2010 01:00:00 +0200</pubDate> + <title>title of document 2</title> + </item> + <item> + <guid>http://example.com/document_module/1</guid> + <link>http://example.com/document_module/1</link> + <description/> + <pubDate>Mon, 27 Sep 2010 00:00:00 +0200</pubDate> + <title>title of document 1</title> + </item> + </channel> +</rss> diff --git a/product/ERP5OOo/tests/test_document/TEST-en-002.xml b/product/ERP5OOo/tests/test_document/TEST-en-002.xml new file mode 100644 index 0000000000..3bdabcfdd7 --- /dev/null +++ b/product/ERP5OOo/tests/test_document/TEST-en-002.xml @@ -0,0 +1,23 @@ +<?xml version="1.0"?> +<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" version="2.0"> + <channel> + <atom:link rel="self" type="application/rss+xml" href="http://example.com/WebSection_viewContentListAsRSS"/> + <title>example.com</title> + <link>http://example.com</link> + <description/> + <item> + <guid>http://example.com/document_module/2</guid> + <link>http://example.com/document_module/2</link> + <description/> + <pubDate>Mon, 27 Sep 2010 01:00:00 +0200</pubDate> + <title>title of document 2</title> + </item> + <item> + <guid>http://example.com/document_module/1</guid> + <link>http://example.com/document_module/1</link> + <description/> + <pubDate>Mon, 27 Sep 2010 00:00:00 +0200</pubDate> + <title>title of document 1</title> + </item> + </channel> +</rss> -- 2.30.9