X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ice_validator%2Ftests%2Fconftest.py;h=5653cca97eb470e4f093cc62f0eb721c2fb626ba;hb=b395eb5bb6c79558202a3d414982a56fac7c9e1d;hp=b09a8aa7ac71b78bc6bcc29585f40b5009f7bd0a;hpb=ac00e6ea5fe3f53fa4d4b57e0e302f6bceca7066;p=vvp%2Fvalidation-scripts.git diff --git a/ice_validator/tests/conftest.py b/ice_validator/tests/conftest.py index b09a8aa..5653cca 100644 --- a/ice_validator/tests/conftest.py +++ b/ice_validator/tests/conftest.py @@ -43,6 +43,10 @@ import json import os import re import time +try: + from html import escape +except ImportError: + from cgi import escape from collections import defaultdict import traceback @@ -745,8 +749,9 @@ def generate_html_report(outpath, categories, template_path, failures): { "file_links": make_href(failure.files, template_path), "test_id": failure.test_id, - "error_message": failure.error_message.replace("\n", "

"), - "raw_output": failure.raw_output, + "error_message": escape(failure.error_message).replace("\n", + "

"), + "raw_output": escape(failure.raw_output), "requirements": docutils.core.publish_parts( writer_name="html", source=failure.requirement_text(reqs) )["body"], @@ -958,7 +963,7 @@ def hash_directory(path): :param path: string directory containing files :return: string MD5 hash code (hex) """ - md5 = hashlib.md5() + md5 = hashlib.md5() # nosec for dir_path, sub_dirs, filenames in os.walk(path): for filename in filenames: file_path = os.path.join(dir_path, filename)