本文整理汇总了Python中Src.Function.Base.Base.todo_string方法的典型用法代码示例。如果您正苦于以下问题:Python Base.todo_string方法的具体用法?Python Base.todo_string怎么用?Python Base.todo_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Src.Function.Base.Base
的用法示例。
在下文中一共展示了Base.todo_string方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_test_result
# 需要导入模块: from Src.Function.Base import Base [as 别名]
# 或者: from Src.Function.Base.Base import todo_string [as 别名]
def set_test_result(cls, response, status_code, interfacename, casename, comment, result):
"""
存入测试结果
:param response:
:param status_code:
:param interfacename:
:param casename:
:param comment:
:param result:
:param main:
:return:
"""
base = Base()
tr = test_result()
tr.__init__()
status = ''
res_time = ''
main = Run.Main
type = base.getApiType(interfacename)
try:
res_time = Misc.read_from_file('res_time')[0]
status = response['succ']
cls.response_new = 'succ:%s' % response['succ']
try:
if response['succ'] != '1':
# 有可能不存在msg,try一下
cls.response_new = response['msg']
except:
pass
except:
status = status_code
cls.response_new = Base.todo_string(response)
finally:
try:
if main in 'api':
# 操作 api_pass_rate表
if result in 'Fail':
if 'xx' in url_target:
apr.update_fail_num(interfacename)
else:
aprwph.update_fail_num(interfacename)
else:
if 'xx' in url_target:
apr.update_pass_num(interfacename)
else:
aprwph.update_pass_num(interfacename)
# 操作api_performance表
if int(res_time) > 0.3:
status = 'Fail'
else:
status = 'Pass'
data = {
"if_name": interfacename,
"case_name": casename,
"res_time": res_time,
"type": type,
"status": status,
}
ap.insert_apiPerformance(data)
# 操作test_result表
data = {
"if_name": interfacename,
"case_name": casename,
"comment": comment,
"status": status,
"result": result,
"response": cls.response_new,
"url_target": url_target,
"type": type,
"main": main,
}
tr.insert_testResult(data)
except Exception as msg:
print (msg)
raise