Commit d5564ccf authored by Tristan Cavelier's avatar Tristan Cavelier

erp5_run_my_doc: move extension and test to portal_components

Also remove unused broken function
parent 44380d16
...@@ -7,7 +7,7 @@ def parseTestReport(text): ...@@ -7,7 +7,7 @@ def parseTestReport(text):
parser.feed(text) parser.feed(text)
root = parser.close() root = parser.close()
table = root.xpath('//table[@id="SELENIUM-TEST"]')[0] table = root.xpath('//table[@id="SELENIUM-TEST"]')[0]
report = {} report = dict()
header = table[0][0] header = table[0][0]
report['status'] = header.attrib['class'].find('passed') > -1 report['status'] = header.attrib['class'].find('passed') > -1
report['name'] = header[0].text report['name'] = header[0].text
...@@ -53,56 +53,6 @@ def parseTestReport(text): ...@@ -53,56 +53,6 @@ def parseTestReport(text):
return dict(title = title, text = lxml.html.tostring(html)) return dict(title = title, text = lxml.html.tostring(html))
""" """
"""
Parse a HTML page and return a list of dictionnaries with the chapters and the tests they contain
"""
def parseTutorial(text):
from Products.ERP5Type.Document import newTempBase
from lxml import etree
parser = etree.HTMLParser(remove_comments=True)
parser.feed(text)
root = parser.close()
table_list = root.xpath('//table[@id="SELENIUM-TEST"]')
table = table_list[0]
listbox = []
i = 0
# Insert only the content of tbody
for table in table_list:
listbox.append(newTempBase(context.getPortalObject(),
'',
title = "Tested Chapter " + str(i),
tag = 'h1'))
if len(table) > 0:
for row in table[-1]:
if(row.tag.lower() == 'tr'):
listbox.append(newTempBase(context.getPortalObject(),
'',
title = row[0][0].text,
tag = 'tr',
arg0 = row[0][1].text,
arg1 = row[0][2].text))
else:
listbox.append(newTempBase(context.getPortalObject(),
'',
title = row[0][0].text,
tag = 'tr',
arg0 = row[0][1].text,
arg1 = row[0][2].text))
stack = [html[1]]
# Let's display everything in the test by removing the style attributes (they're not supposed to have any style attributes at all during the tests)
while stack:
element = stack.pop()
if element.attrib.has_key('style'):
del element.attrib['style']
for child in element:
stack.append(child)
return dict(title = title, text = lxml.html.tostring(html))
""" """
Return the content of a web page Return the content of a web page
""" """
...@@ -115,7 +65,6 @@ def urlread(url): ...@@ -115,7 +65,6 @@ def urlread(url):
""" """
def extractTest(text): def extractTest(text):
import lxml.html import lxml.html
from lxml import etree
root = lxml.html.fromstring(text) root = lxml.html.fromstring(text)
table_list = root.xpath('//test') table_list = root.xpath('//test')
testcode = "" testcode = ""
...@@ -135,7 +84,6 @@ def extractTest(text): ...@@ -135,7 +84,6 @@ def extractTest(text):
""" """
def validateHTML5Document(text): def validateHTML5Document(text):
import lxml.html import lxml.html
from lxml import etree
root = lxml.html.fromstring(text) root = lxml.html.fromstring(text)
section_list = root.xpath('//section') section_list = root.xpath('//section')
count = 0 count = 0
...@@ -160,5 +108,3 @@ def validateHTML5Document(text): ...@@ -160,5 +108,3 @@ def validateHTML5Document(text):
error_list.append("Section %s has no details tag." % (count)) error_list.append("Section %s has no details tag." % (count))
return error_list return error_list
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Extension Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>ERP5RunMyDocs</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>extension.erp5.ERP5RunMyDocs</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Extension Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testRunMyDoc</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testRunMyDoc</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
ERP5RunMyDocs extension.erp5.ERP5RunMyDocs
\ No newline at end of file \ No newline at end of file
testRunMyDoc test.erp5.testRunMyDoc
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment