mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-12 16:01:27 +08:00
Merge pull request #516 from HttpRunner/bugfix
bugfixes with Chinese charactors
This commit is contained in:
@@ -37,7 +37,7 @@ def setup_logger(log_level, log_file=None):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if log_file:
|
if log_file:
|
||||||
handler = logging.FileHandler(log_file)
|
handler = logging.FileHandler(log_file, encoding="utf-8")
|
||||||
else:
|
else:
|
||||||
handler = logging.StreamHandler()
|
handler = logging.StreamHandler()
|
||||||
|
|
||||||
|
|||||||
@@ -661,7 +661,13 @@ def dump_json_file(json_data, pwd_dir_path, dump_file_name):
|
|||||||
))
|
))
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
json.dump(json_data, outfile, indent=4, separators=(',', ':'))
|
json.dump(
|
||||||
|
json_data,
|
||||||
|
outfile,
|
||||||
|
indent=4,
|
||||||
|
separators=(',', ':'),
|
||||||
|
ensure_ascii=False
|
||||||
|
)
|
||||||
|
|
||||||
msg = "dump file: {}".format(dump_file_path)
|
msg = "dump file: {}".format(dump_file_path)
|
||||||
logger.color_print(msg, "BLUE")
|
logger.color_print(msg, "BLUE")
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ def teardown_hook_sleep_N_secs(response, n_secs):
|
|||||||
def hook_print(msg):
|
def hook_print(msg):
|
||||||
print(msg)
|
print(msg)
|
||||||
|
|
||||||
def modify_headers_os_platform(request, os_platform):
|
def modify_request_json(request, os_platform):
|
||||||
request["headers"]["os_platform"] = os_platform
|
request["json"]["os_platform"] = os_platform
|
||||||
|
|
||||||
def setup_hook_httpntlmauth(request):
|
def setup_hook_httpntlmauth(request):
|
||||||
if "httpntlmauth" in request:
|
if "httpntlmauth" in request:
|
||||||
|
|||||||
@@ -164,19 +164,19 @@ class TestRunner(ApiServerUnittest):
|
|||||||
"method": "POST",
|
"method": "POST",
|
||||||
"headers": {
|
"headers": {
|
||||||
"content-type": "application/json",
|
"content-type": "application/json",
|
||||||
"user_agent": "iOS/10.3",
|
"user_agent": "iOS/10.3"
|
||||||
"os_platform": "ios"
|
|
||||||
},
|
},
|
||||||
"json": {
|
"json": {
|
||||||
|
"os_platform": "ios",
|
||||||
"sign": "f1219719911caae89ccc301679857ebfda115ca2"
|
"sign": "f1219719911caae89ccc301679857ebfda115ca2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"setup_hooks": [
|
"setup_hooks": [
|
||||||
"${modify_headers_os_platform($request, android)}"
|
"${modify_request_json($request, android)}"
|
||||||
],
|
],
|
||||||
"validate": [
|
"validate": [
|
||||||
{"check": "status_code", "expect": 200},
|
{"check": "status_code", "expect": 200},
|
||||||
{"check": "content.headers.Os-Platform", "expect": "android"}
|
{"check": "content.json.os_platform", "expect": "android"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
test_runner = runner.Runner(config_dict, self.debugtalk_functions)
|
test_runner = runner.Runner(config_dict, self.debugtalk_functions)
|
||||||
|
|||||||
Reference in New Issue
Block a user