Commit 7a838ee4 authored by Alain Takoudjou's avatar Alain Takoudjou

slapos_monitoring_ui_test: set unsafe monitoring website and fix backend test http server

monitoring_rjs_unsafe website for tests which allow ajax on local test http server
Add missing option on local http server
fix start of http server (address already in use)
parent 34a91bc8
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<!-- Initialize --> <!-- Initialize -->
<tr> <tr>
<td>open</td> <td>open</td>
<td>${base_url}/web_site_module/monitoring_render_js/#page=settings_configurator&tab=add</td> <td>${base_url}/web_site_module/monitoring_rjs_unsafe/#page=settings_configurator&tab=add</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -77,24 +77,44 @@ ...@@ -77,24 +77,44 @@
<td>1000</td> <td>1000</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>assertTextPresent</td>
<td>Load OPML</td>
<td></td>
</tr>
<tr> <tr>
<td>assertTextNotPresent</td> <td>assertTextNotPresent</td>
<td>ERROR: Failed to load URL</td> <td>ERROR: Failed to load URL</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>assertElementPresent</td>
<td>//table[contains(@class, 'custom-force-list')]</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>http://localhost:5378/rootInstance/public/feed</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>TEST Hosting Subscription</td>
<td></td>
</tr>
<tr> <tr>
<td>assertTextPresent</td> <td>assertTextPresent</td>
<td>Software Instance</td> <td>rootInstance</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertTextPresent</td> <td>assertTextPresent</td>
<td>Hosting Subscription</td> <td>subInstance-1</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>assertTextPresent</td> <td>assertTextPresent</td>
<td>URL Type</td> <td>subInstance-2</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
...@@ -292,11 +312,13 @@ ...@@ -292,11 +312,13 @@
<td>2000</td> <td>2000</td>
<td></td> <td></td>
</tr> </tr>
<!--
<tr> <tr>
<td>waitForTextPresent</td> <td>waitForTextPresent</td>
<td>Monitoring OPML List</td> <td>Monitoring OPML List</td>
<td></td> <td></td>
</tr> </tr>
-->
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//button[contains(@class, 'sync-all')]</td> <td>//button[contains(@class, 'sync-all')]</td>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Site" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>__before_publishing_traverse__</string> </key>
<value>
<object>
<klass>
<global name="MultiHook" module="ZPublisher.BeforeTraverse"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_defined_in_class</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>_hookname</string> </key>
<value> <string>__before_publishing_traverse__</string> </value>
</item>
<item>
<key> <string>_list</string> </key>
<value>
<list>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAc=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAg=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAk=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAo=</string> </persistent>
</list>
</value>
</item>
<item>
<key> <string>_prior</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>__before_traverse__</string> </key>
<value>
<dictionary>
<item>
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Site/bug_tracker</string>
</tuple>
</key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Site/e5g_ecommerce</string>
</tuple>
</key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Site/e5g_ehr</string>
</tuple>
</key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Site/e5g_eprocurement</string>
</tuple>
</key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
<item>
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Site/monitoring_render_js</string>
</tuple>
</key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
</value>
</item>
<item>
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Site/monitoring_rjs_unsafe</string>
</tuple>
</key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAc=</string> </persistent>
</value>
</item>
<item>
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Site/officejs_text_editor</string>
</tuple>
</key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAg=</string> </persistent>
</value>
</item>
<item>
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Site/renderjs_runner</string>
</tuple>
</key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAk=</string> </persistent>
</value>
</item>
<item>
<key>
<tuple>
<int>99</int>
<string>ERP5 Web Site/spread</string>
</tuple>
</key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAo=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAs=</string> </persistent>
</value>
</item>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAw=</string> </persistent>
</value>
</item>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>frontpage_gadget_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_frontpage_gadget_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_application_title</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_hateoas_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_view_action_category</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_default_view_action_reference</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_panel_gadget_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_router_gadget_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_jio_gadget_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_translation_gadget_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_manifest_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_header_gadget_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_content_security_policy</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAA0=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAA4=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAA8=</string> </persistent>
</value>
</item>
<item>
<key> <string>available_language</string> </key>
<value>
<tuple>
<string>en</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>aggregate/web_page_module/rjs_gadget_erp5_html</string>
<string>caching_policy/must-revalidate</string>
</tuple>
</value>
</item>
<item>
<key> <string>configuration_application_title</string> </key>
<value> <string>Monitoring</string> </value>
</item>
<item>
<key> <string>configuration_content_security_policy</string> </key>
<value> <string>default-src \'none\'; img-src \'self\' data:; media-src \'self\' blob:; connect-src \'self\' mail.tiolive.com data: *; script-src \'self\' \'unsafe-eval\'; font-src netdna.bootstrapcdn.com; style-src \'self\' netdna.bootstrapcdn.com \'unsafe-inline\' data:; frame-src \'self\' data:</string> </value>
</item>
<item>
<key> <string>configuration_default_view_action_reference</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>configuration_frontpage_gadget_url</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>configuration_hateoas_url</string> </key>
<value> <string>hateoas/</string> </value>
</item>
<item>
<key> <string>configuration_header_gadget_url</string> </key>
<value> <string>gadget_monitoring_header.html</string> </value>
</item>
<item>
<key> <string>configuration_jio_gadget_url</string> </key>
<value> <string>gadget_monitoring_jio.html</string> </value>
</item>
<item>
<key> <string>configuration_manifest_url</string> </key>
<value> <string>gadget_monitoring.appcache</string> </value>
</item>
<item>
<key> <string>configuration_panel_gadget_url</string> </key>
<value> <string>gadget_monitoring_application_panel.html</string> </value>
</item>
<item>
<key> <string>configuration_router_gadget_url</string> </key>
<value> <string>gadget_monitoring_router.html</string> </value>
</item>
<item>
<key> <string>configuration_translation_gadget_url</string> </key>
<value> <string>gadget_translation.html</string> </value>
</item>
<item>
<key> <string>configuration_view_action_category</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>container_layout</string> </key>
<value> <string>WebSection_renderDefaultPageAsGadget</string> </value>
</item>
<item>
<key> <string>content_layout</string> </key>
<value> <string>WebSection_renderDefaultPageAsGadget</string> </value>
</item>
<item>
<key> <string>custom_render_method_id</string> </key>
<value> <string>WebSection_renderDefaultPageAsGadget</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>frontpage_gadget_url</string> </key>
<value> <string>gadget_woelfel_pt_frontpage.html</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>monitoring_rjs_unsafe</string> </value>
</item>
<item>
<key> <string>layout_configuration_form_id</string> </key>
<value> <string>WebSection_viewRenderJSPreference</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Site</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>skin_selection_name</string> </key>
<value> <string>RJS</string> </value>
</item>
<item>
<key> <string>static_language_selection</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Monitoring Interface</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="WebSiteTraversalHook" module="Products.ERP5.Document.WebSite"/>
</pickle>
<pickle>
<dictionary/>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WebSiteTraversalHook" module="Products.ERP5.Document.WebSite"/>
</pickle>
<pickle>
<dictionary/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WebSiteTraversalHook" module="Products.ERP5.Document.WebSite"/>
</pickle>
<pickle>
<dictionary/>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WebSiteTraversalHook" module="Products.ERP5.Document.WebSite"/>
</pickle>
<pickle>
<dictionary/>
</pickle>
</record>
<record id="6" aka="AAAAAAAAAAY=">
<pickle>
<global name="WebSiteTraversalHook" module="Products.ERP5.Document.WebSite"/>
</pickle>
<pickle>
<dictionary/>
</pickle>
</record>
<record id="7" aka="AAAAAAAAAAc=">
<pickle>
<global name="WebSiteTraversalHook" module="Products.ERP5.Document.WebSite"/>
</pickle>
<pickle>
<dictionary/>
</pickle>
</record>
<record id="8" aka="AAAAAAAAAAg=">
<pickle>
<global name="WebSiteTraversalHook" module="Products.ERP5.Document.WebSite"/>
</pickle>
<pickle>
<dictionary/>
</pickle>
</record>
<record id="9" aka="AAAAAAAAAAk=">
<pickle>
<global name="WebSiteTraversalHook" module="Products.ERP5.Document.WebSite"/>
</pickle>
<pickle>
<dictionary/>
</pickle>
</record>
<record id="10" aka="AAAAAAAAAAo=">
<pickle>
<global name="WebSiteTraversalHook" module="Products.ERP5.Document.WebSite"/>
</pickle>
<pickle>
<dictionary/>
</pickle>
</record>
<record id="11" aka="AAAAAAAAAAs=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="12" aka="AAAAAAAAAAw=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="13" aka="AAAAAAAAAA0=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="14" aka="AAAAAAAAAA4=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="15" aka="AAAAAAAAAA8=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
...@@ -34,8 +34,9 @@ from datetime import datetime ...@@ -34,8 +34,9 @@ from datetime import datetime
import SocketServer import SocketServer
import tempfile import tempfile
import os import shutil
import time import time
import os
import json import json
class CustomHTTPRequestHandler(SimpleHTTPRequestHandler): class CustomHTTPRequestHandler(SimpleHTTPRequestHandler):
...@@ -54,6 +55,8 @@ class CustomHTTPRequestHandler(SimpleHTTPRequestHandler): ...@@ -54,6 +55,8 @@ class CustomHTTPRequestHandler(SimpleHTTPRequestHandler):
self.send_header("Access-Control-Allow-Methods", "HEAD, OPTIONS, GET, POST") self.send_header("Access-Control-Allow-Methods", "HEAD, OPTIONS, GET, POST")
self.send_header("Access-Control-Allow-Headers", "Overwrite, Destination, Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control, Authorization") self.send_header("Access-Control-Allow-Headers", "Overwrite, Destination, Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control, Authorization")
def do_GET(self):
SimpleHTTPRequestHandler.do_GET(self)
def do_OPTIONS(self): def do_OPTIONS(self):
self.send_respond(200) self.send_respond(200)
...@@ -67,6 +70,7 @@ class TestZeleniumCore(ERP5TypeFunctionalTestCase): ...@@ -67,6 +70,7 @@ class TestZeleniumCore(ERP5TypeFunctionalTestCase):
base_url = 'http://localhost:5378' base_url = 'http://localhost:5378'
instance_list = [] instance_list = []
httpd = None httpd = None
httpd_is_alive = False
root_title = "TEST Hosting Subscription" root_title = "TEST Hosting Subscription"
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
...@@ -82,8 +86,13 @@ class TestZeleniumCore(ERP5TypeFunctionalTestCase): ...@@ -82,8 +86,13 @@ class TestZeleniumCore(ERP5TypeFunctionalTestCase):
def start_httpd_server(self, root_folder): def start_httpd_server(self, root_folder):
self.httpd = SocketServer.TCPServer(('localhost', 5378), CustomHTTPRequestHandler) self.httpd = SocketServer.TCPServer(('localhost', 5378), CustomHTTPRequestHandler)
self.httpd.timeout = 2
os.chdir(root_folder) os.chdir(root_folder)
self.httpd.serve_forever() #self.httpd.serve_forever()
while self.httpd_is_alive:
self.httpd.handle_request()
self.httpd = None
def afterSetUp(self): def afterSetUp(self):
ERP5TypeFunctionalTestCase.afterSetUp(self) ERP5TypeFunctionalTestCase.afterSetUp(self)
...@@ -92,15 +101,20 @@ class TestZeleniumCore(ERP5TypeFunctionalTestCase): ...@@ -92,15 +101,20 @@ class TestZeleniumCore(ERP5TypeFunctionalTestCase):
self.http_root_dir = tempfile.mkdtemp() self.http_root_dir = tempfile.mkdtemp()
self.generateMonitoringInstanceTree() self.generateMonitoringInstanceTree()
if self.httpd is None: self.httpd_is_alive = True
#self.httpd.shutdown()
print "Httpd is staring..."
thread = Thread(target=self.start_httpd_server, args=(self.http_root_dir,)) thread = Thread(target=self.start_httpd_server, args=(self.http_root_dir,))
thread.daemon = True thread.daemon = True
thread.start() thread.start()
def beforeTearDown(self):
self.httpd_is_alive = False
# Wait for httpd server stop
time.sleep(3)
if os.path.exists(self.http_root_dir):
shutil.rmtree(self.http_root_dir)
ERP5TypeFunctionalTestCase.beforeTearDown(self)
def generateInstanceDirectory(self, name): def generateInstanceDirectory(self, name):
print "setup %s" % name
root_dir = os.path.join(self.http_root_dir, name) root_dir = os.path.join(self.http_root_dir, name)
public_http_dir = os.path.join(root_dir, 'public') public_http_dir = os.path.join(root_dir, 'public')
private_http_dir = os.path.join(root_dir, 'private') private_http_dir = os.path.join(root_dir, 'private')
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple>
<string>W:154, 2: Dangerous default value [] as argument (dangerous-default-value)</string> <string>W:168, 2: Dangerous default value [] as argument (dangerous-default-value)</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
portal_tests/slapos_monitoring_ui_zuite portal_tests/slapos_monitoring_ui_zuite
portal_tests/slapos_monitoring_ui_zuite/** portal_tests/slapos_monitoring_ui_zuite/**
web_site_module/monitoring_rjs_unsafe
web_site_module/monitoring_rjs_unsafe/**
\ 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