fix compatibility in Python version < 3.6

This commit is contained in:
debugtalk
2019-03-04 20:23:26 +08:00
parent 7e84c01b07
commit cfc664b280

View File

@@ -1,4 +1,5 @@
import os import os
import re
import shutil import shutil
import time import time
import unittest import unittest
@@ -537,10 +538,12 @@ class TestHttpRunner(ApiServerUnittest):
} }
report_path = self.runner.run(tests_mapping) report_path = self.runner.run(tests_mapping)
with open(report_path) as f: with open(report_path) as f:
self.assertIn( content = f.read()
"&#34;&lt;img src=x onerror=alert(1)&gt;&#34;}&#39;", m = re.findall(
f.read() re.escape("&#34;person&#34;: &#34;&lt;img src=x onerror=alert(1)&gt;&#34;"),
content
) )
self.assertEqual(len(m), 2)
class TestApi(ApiServerUnittest): class TestApi(ApiServerUnittest):