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>
......
...@@ -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() thread = Thread(target=self.start_httpd_server, args=(self.http_root_dir,))
print "Httpd is staring..." thread.daemon = True
thread = Thread(target=self.start_httpd_server, args=(self.http_root_dir,)) thread.start()
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): 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/**
\ No newline at end of file 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