Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
137
Merge Requests
137
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
ab7cbf9a
Commit
ab7cbf9a
authored
Nov 28, 2014
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add html file test
parent
6ddf879e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
product/ERP5/tests/testXHTML.py
product/ERP5/tests/testXHTML.py
+51
-0
No files found.
product/ERP5/tests/testXHTML.py
View file @
ab7cbf9a
...
...
@@ -194,6 +194,57 @@ class TestXHTMLMixin(ERP5TypeTestCase):
check_path
=
'%s/%s'
%
(
portal_skins_path
,
path
)
jsl
(
check_path
)
def
test_html_file
(
self
):
path_list
=
os
.
environ
.
get
(
'CGI_PATH'
,
'/usr/lib/cgi-bin:/usr/lib/cgi-bin/w3c-markup-validator'
).
split
(
os
.
pathsep
)
for
path
in
path_list
:
validator_path
=
os
.
path
.
join
(
path
,
'check'
)
if
os
.
path
.
exists
(
validator_path
):
validator
=
W3Validator
(
validator_path
,
show_warnings
)
break
if
validator
is
not
None
:
skins_tool
=
self
.
portal
.
portal_skins
path_list
=
[]
for
script_path
,
script
in
skins_tool
.
ZopeFind
(
skins_tool
,
obj_metatypes
=
[
'File'
],
search_sub
=
1
):
is_required_check_path
=
True
ignore_bts
=
[
'erp5_jquery'
,
'erp5_fckeditor'
,
'erp5_xinha_editor'
,
'erp5_jquery_ui'
]
if
script_path
.
endswith
(
'.html'
):
for
ignore_bt_name
in
ignore_bts
:
if
script_path
.
startswith
(
ignore_bt_name
):
is_required_check_path
=
False
break
;
if
is_required_check_path
:
path_list
.
append
(
script_path
)
def
validate_html_file
(
source_path
):
message
=
[
'Using %s validator to parse the file "%s"'
' with warnings%sdisplayed :'
%
(
validator
.
name
,
source_path
,
validator
.
show_warnings
and
' '
or
' NOT '
)]
source
=
self
.
publish
(
source_path
).
getBody
()
result_list_list
=
validator
.
getErrorAndWarningList
(
source
)
severity_list
=
[
'Error'
]
if
validator
.
show_warnings
:
severity_list
.
append
(
'Warning'
)
for
i
,
severity
in
enumerate
(
severity_list
):
for
line
,
column
,
msg
in
result_list_list
[
i
]:
if
line
is
None
and
column
is
None
:
message
.
append
(
'%s: %s'
%
(
severity
,
msg
))
else
:
message
.
append
(
'%s: line %s column %s : %s'
%
(
severity
,
line
,
column
,
msg
))
return
len
(
message
)
==
1
,
'
\
n
'
.
join
(
message
)
def
html_file
(
check_path
):
self
.
assert_
(
*
validate_html_file
(
source_path
=
check_path
))
portal_skins_path
=
'%s/portal_skins'
%
self
.
portal
.
getId
()
for
path
in
path_list
:
check_path
=
'%s/%s'
%
(
portal_skins_path
,
path
)
html_file
(
check_path
)
def
test_PythonScriptSyntax
(
self
):
"""
Check that Python Scripts syntax is correct.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment