Commit 63ec1fef authored by Rafael Monnerat's avatar Rafael Monnerat

Code style, comments and spell fixes.

Several changes which only improve code readability only.
parent 77875a6e
...@@ -48,6 +48,8 @@ TEST_RESULT_RE = re.compile('<div style="padding-top: 10px;">\s*<p>\s*' ...@@ -48,6 +48,8 @@ TEST_RESULT_RE = re.compile('<div style="padding-top: 10px;">\s*<p>\s*'
TEST_ERROR_RESULT_RE = re.compile('.*(?:error.gif|title status_failed).*', re.S) TEST_ERROR_RESULT_RE = re.compile('.*(?:error.gif|title status_failed).*', re.S)
ZELENIUM_BASE_URL = "%s/portal_tests/%s/core/TestRunner.html?test=../test_suite_html&auto=on&resultsUrl=%s/portal_tests/postResults&__ac_name=%s&__ac_password=%s"
tests_framework_home = os.path.dirname(os.path.abspath(__file__)) tests_framework_home = os.path.dirname(os.path.abspath(__file__))
# handle 'system global' instance # handle 'system global' instance
if tests_framework_home.startswith('/usr/lib'): if tests_framework_home.startswith('/usr/lib'):
...@@ -125,8 +127,8 @@ class Firefox: ...@@ -125,8 +127,8 @@ class Firefox:
print 'firefox : %d' % self.pid print 'firefox : %d' % self.pid
return self.pid return self.pid
def getPrefJs(self, host, port): def getPrefJs(self):
prefs_js = """ return """
// Don't ask if we want to switch default browsers // Don't ask if we want to switch default browsers
user_pref("browser.shell.checkDefaultBrowser", false); user_pref("browser.shell.checkDefaultBrowser", false);
...@@ -158,10 +160,8 @@ user_pref("dom.max_script_run_time", 120); ...@@ -158,10 +160,8 @@ user_pref("dom.max_script_run_time", 120);
// this is required to upload files // this is required to upload files
user_pref("capability.principal.codebase.p1.granted", "UniversalFileRead"); user_pref("capability.principal.codebase.p1.granted", "UniversalFileRead");
user_pref("signed.applets.codebase_principal_support", true); user_pref("signed.applets.codebase_principal_support", true);
user_pref("capability.principal.codebase.p1.id", "http://%s"); user_pref("capability.principal.codebase.p1.id", "http://%s:%s");
user_pref("capability.principal.codebase.p1.subjectName", "");""" % \ user_pref("capability.principal.codebase.p1.subjectName", "");""" % \
'%s:%s' % (host, port)
return prefs_js
def _prepare(self): def _prepare(self):
prefs_js = self.getPrefJs(self.host, self.port) prefs_js = self.getPrefJs(self.host, self.port)
...@@ -177,7 +177,6 @@ user_pref("capability.principal.codebase.p1.subjectName", "");""" % \ ...@@ -177,7 +177,6 @@ user_pref("capability.principal.codebase.p1.subjectName", "");""" % \
class FunctionalTestRunner: class FunctionalTestRunner:
ZELENIUM_BASE_URL = "%s/portal_tests/core/TestRunner.html?test=../test_suite_html&auto=on&resultsUrl=%s/portal_tests/postResults&__ac_name=%s&__ac_password=%s"
def __init__(self, host, port, portal, run_only=''): def __init__(self, host, port, portal, run_only=''):
...@@ -198,15 +197,9 @@ class FunctionalTestRunner: ...@@ -198,15 +197,9 @@ class FunctionalTestRunner:
transaction.commit() transaction.commit()
return self.portal.portal_tests.TestTool_getResults() return self.portal.portal_tests.TestTool_getResults()
def _getTestURL(self, run_only): def _getTestURL(self):
url_string = self.ZELENIUM_BASE_URL % (self.portal_url, return ZELENIUM_BASE_URL % (self.portal.portal_url(), self.run_only,
self.portal_url, self.portal.portal_url(), self.user, self.password)
self.user,
self.password)
if run_only:
url_string = url_string.replace('/portal_tests/',
'/portal_tests/%s/' % self.run_only, 1)
return url_string
def launchFunctionalTest(self, debug=0): def launchFunctionalTest(self, debug=0):
pid = None pid = None
...@@ -276,6 +269,8 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase): ...@@ -276,6 +269,8 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
conversion_server_hostname=conversion_dict['hostname'], conversion_server_hostname=conversion_dict['hostname'],
conversion_server_port=conversion_dict['port'] conversion_server_port=conversion_dict['port']
) )
# XXX Memcached is missing
# XXX Persistent cache setup is missing
def testFunctionalTestRunner(self): def testFunctionalTestRunner(self):
# first of all, abort to get rid of the mysql participation inn this # first of all, abort to get rid of the mysql participation inn this
...@@ -285,13 +280,13 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase): ...@@ -285,13 +280,13 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
self.portal, self.run_only) self.portal, self.run_only)
self.runner.launchFunctionalTest(debug=self.foreground) self.runner.launchFunctionalTest(debug=self.foreground)
detail, sucess, failure, error_title_list = self.runner.processResult() detail, success, failure, error_title_list = self.runner.processResult()
self.logMessage("-"*79) self.logMessage("-" * 79)
total = sucess + failure total = success + failure
self.logMessage("%s Functional Tests %s Tests, %s Failures" % \ self.logMessage("%s Functional Tests %s Tests, %s Failures" % \
(self.getTitle(), total, failure)) (self.getTitle(), total, failure))
self.logMessage("-"*79) self.logMessage("-" * 79)
self.logMessage(detail) self.logMessage(detail)
self.logMessage("-"*79) self.logMessage("-" * 79)
self.assertEquals([], error_title_list) self.assertEquals([], error_title_list)
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