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 @@
<!-- Initialize -->
<tr>
<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>
</tr>
<tr>
......@@ -77,24 +77,44 @@
<td>1000</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Load OPML</td>
<td></td>
</tr>
<tr>
<td>assertTextNotPresent</td>
<td>ERROR: Failed to load URL</td>
<td></td>
</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>
<td>assertTextPresent</td>
<td>Software Instance</td>
<td>rootInstance</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Hosting Subscription</td>
<td>subInstance-1</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>URL Type</td>
<td>subInstance-2</td>
<td></td>
</tr>
<tr>
......@@ -292,11 +312,13 @@
<td>2000</td>
<td></td>
</tr>
<!--
<tr>
<td>waitForTextPresent</td>
<td>Monitoring OPML List</td>
<td></td>
</tr>
-->
<tr>
<td>assertElementPresent</td>
<td>//button[contains(@class, 'sync-all')]</td>
......
......@@ -34,8 +34,9 @@ from datetime import datetime
import SocketServer
import tempfile
import os
import shutil
import time
import os
import json
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-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):
self.send_respond(200)
......@@ -67,6 +70,7 @@ class TestZeleniumCore(ERP5TypeFunctionalTestCase):
base_url = 'http://localhost:5378'
instance_list = []
httpd = None
httpd_is_alive = False
root_title = "TEST Hosting Subscription"
def getBusinessTemplateList(self):
......@@ -82,8 +86,13 @@ class TestZeleniumCore(ERP5TypeFunctionalTestCase):
def start_httpd_server(self, root_folder):
self.httpd = SocketServer.TCPServer(('localhost', 5378), CustomHTTPRequestHandler)
self.httpd.timeout = 2
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):
ERP5TypeFunctionalTestCase.afterSetUp(self)
......@@ -92,15 +101,20 @@ class TestZeleniumCore(ERP5TypeFunctionalTestCase):
self.http_root_dir = tempfile.mkdtemp()
self.generateMonitoringInstanceTree()
if self.httpd is None:
#self.httpd.shutdown()
print "Httpd is staring..."
thread = Thread(target=self.start_httpd_server, args=(self.http_root_dir,))
thread.daemon = True
thread.start()
self.httpd_is_alive = True
thread = Thread(target=self.start_httpd_server, args=(self.http_root_dir,))
thread.daemon = True
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):
print "setup %s" % name
root_dir = os.path.join(self.http_root_dir, name)
public_http_dir = os.path.join(root_dir, 'public')
private_http_dir = os.path.join(root_dir, 'private')
......
......@@ -46,7 +46,7 @@
<key> <string>text_content_warning_message</string> </key>
<value>
<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>
</value>
</item>
......
portal_tests/slapos_monitoring_ui_zuite
portal_tests/slapos_monitoring_ui_zuite/**
\ No newline at end of file
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