[ARVADOS] updated: a4b58ddc7b8ec80010dfa30dc6c4ac1ce69858da

git at public.curoverse.com git at public.curoverse.com
Mon Jan 25 16:06:18 EST 2016


Summary of changes:
 tools/crunchstat-summary/crunchstat_summary/chartjs.py |  3 ++-
 tools/crunchstat-summary/tests/test_examples.py        | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

       via  a4b58ddc7b8ec80010dfa30dc6c4ac1ce69858da (commit)
      from  fdd28d6f009c605c61f4444dc2d9d142c3a1d395 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit a4b58ddc7b8ec80010dfa30dc6c4ac1ce69858da
Author: Tom Clegg <tom at curoverse.com>
Date:   Mon Jan 25 16:05:56 2016 -0500

    8123: Escape HTML chars in page title.

diff --git a/tools/crunchstat-summary/crunchstat_summary/chartjs.py b/tools/crunchstat-summary/crunchstat_summary/chartjs.py
index 590df27..fb30041 100644
--- a/tools/crunchstat-summary/crunchstat_summary/chartjs.py
+++ b/tools/crunchstat-summary/crunchstat_summary/chartjs.py
@@ -1,5 +1,6 @@
 from __future__ import print_function
 
+import cgi
 import json
 import pkg_resources
 
@@ -19,7 +20,7 @@ class ChartJS(object):
         <script type="text/javascript" src="{}"></script>
         <script type="text/javascript">{}</script>
         </head><body></body></html>
-        '''.format(self.label, self.JSLIB, self.js())
+        '''.format(cgi.escape(self.label), self.JSLIB, self.js())
 
     def js(self):
         return 'var sections = {};\n{}'.format(
diff --git a/tools/crunchstat-summary/tests/test_examples.py b/tools/crunchstat-summary/tests/test_examples.py
index 4fe7b27..6c14437 100644
--- a/tools/crunchstat-summary/tests/test_examples.py
+++ b/tools/crunchstat-summary/tests/test_examples.py
@@ -34,6 +34,20 @@ class SummarizeFile(ReportDiff):
             self.diff_known_report(logfile, cmd)
 
 
+class HTMLFromFile(ReportDiff):
+    def test_example_files(self):
+        # Note we don't test the output content at all yet; we're
+        # mainly just verifying the --format=html option isn't ignored
+        # and the HTML code path doesn't crash.
+        for fnm in glob.glob(os.path.join(TESTS_DIR, '*.txt.gz')):
+            logfile = os.path.join(TESTS_DIR, fnm)
+            args = crunchstat_summary.command.ArgumentParser().parse_args(
+                ['--format=html', '--log-file', logfile])
+            cmd = crunchstat_summary.command.Command(args)
+            cmd.run()
+            self.assertRegexpMatches(cmd.report(), r'(?is)<html>.*</html>\s*$')
+
+
 class SummarizeEdgeCases(unittest.TestCase):
     def test_error_messages(self):
         logfile = open(os.path.join(TESTS_DIR, 'crunchstat_error_messages.txt'))

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list