From 6c76f2d8b4c16142724712d62b09f166c7862099 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Mon, 4 Mar 2019 20:23:26 +0800 Subject: [PATCH] fix compatibility in Python version < 3.6 --- tests/test_api.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_api.py b/tests/test_api.py index da78f9b5..b0b240f3 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -1,4 +1,5 @@ import os +import re import shutil import time import unittest @@ -537,10 +538,12 @@ class TestHttpRunner(ApiServerUnittest): } report_path = self.runner.run(tests_mapping) with open(report_path) as f: - self.assertIn( - ""<img src=x onerror=alert(1)>"}'", - f.read() + content = f.read() + m = re.findall( + re.escape(""person": "<img src=x onerror=alert(1)>""), + content ) + self.assertEqual(len(m), 2) class TestApi(ApiServerUnittest):