Commit ee402134 authored by jinfang.liu's avatar jinfang.liu

1

parents 74312aa4 c6543e07
......@@ -16,7 +16,7 @@ term = 6
amount = 10000
productid = 1
repaymenttype = 微信
bancode = {'ICBC':'62220202'}
bancode = {'ICBC':'62220202','PINGAN':'62229848'}
terms = [1,2,3,6,9,12]
amounts = [2000,4000,6000,10000,20000,30000]
productids = [1,4]
......@@ -27,32 +27,33 @@ loanid = 18
totalloanamount = 1666.67
termno = 4
verificationid = BK744588885171192830848411
applyno = AN000000143194020672184320
applyno = AN000000143208211244130304
[globalvar]
password = 123456aaa
biztype = 0
token = eb298e58-b438-4437-ab29-70973e7210a2
passportapitoken = 834a1109-bb71-4cfb-ad1f-f31225439a8b
passportapitoken = 1396bf28-64f4-44b6-9eec-bb334c08fc5e
opapitoken = 5375b6c5-527e-4c3a-8c66-b9ef96a7412d
cardnoprovider = ICBC
apitoken = aef03bc7-2b7a-4b86-bb32-4c4321b404ab
mapitoken = d695c065-540a-40a1-8f18-749e1d0cfc30
apitoken = 1396bf28-64f4-44b6-9eec-bb334c08fc5e
mapitoken = 75d2421775d0b74ca27b28677bfa63410285
quotarecordorderno = {'msg': None, 'code': '0000', 'data': []}
hetongtoken = a758d7e9323225494c74a52b3a43af3e
cardno = 6222020218004048926
msgtoken = {token}
sceneid = 5
deadline = 1589282959000
deadline = 1589164833000
paymenttoken = ff928a66-15f2-444f-852a-e4cff2a508e5
requestid = 63119890137088
vcode = 238345
applyno = AN000000142807192295202816
applyno = AN000000143183669801000960
voicetoken = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1ODgxNTE1OTgsInVzZXJuYW1lIjoidHgueHlxYiJ9.W4fKn-tdbOORELBfUd6KOjrygjzWWFY0zf6dmcqsjiI
logindata = {'uuid': 'e9b16694-e126-4358-be34-1efd049a6e9b', 'channelId': 159866, 'productId': '1', 'channelType': '1', 'source': 2, 'phoneNo': '13805327211', 'idCard': '140781196502039883', 'name': '寿德水', 'compatibleExtData': {}}
[testsuit]
cases_number1 = [358, 359, 360,323, 382, 383, 384, 385,361, 402, 403, 404, 405,401,399,407,367,574,575,577,576,368,371,372,374,375,376,378,363,364,369,370,409,373,410,412,411,413,387, 388,389,390, 391, 392,389, 390, 394, 395, 396, 397]
cases_numbertemp = [{'passportapi':[816,817,323, 382, 383, 384, 385,361, 402, 403, 404, 405,401,399,407,367,574,575,577,576,368,371,372,374,375,376,378,363,364,369,370,409,373,410,412,411,413,387, 388,389,390, 391, 392,389, 390, 394, 395, 396, 397]}]
cases_number1 = [816,817,323, 382, 383, 384, 385,361, 402, 403, 404, 405,401,399,407,367,574,575,577,576,368,371,372,374,375,376,378,363,364,369,370,409,373,410,412,411,413,387, 388,389,390, 391, 392,389, 390, 394, 395, 396, 397]
case_number_fengkong = [509, 510, 511, 512, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549]
case_number3 = [358, 359, 360,323,382, 383,399, 385,407,367,368,371,372,374,375,376,378,363,364,369,370,409,373,410,412,411,413,387, 388,389,390, 391, 392,389, 390, 394, 395, 396, 397]
case_number_usercenter = [504, 494, 508,479, 477, 498, 476, 499, 495, 483, 505, 488, 471, 502, 484, 492, 493, 503, 470, 489, 473, 490, 486, 500, 501, 487, 491, 472, 496, 480, 506, 475, 474, 507, 481, 497, 478,482,485]
......@@ -84,5 +85,5 @@ case_number_case_fengkong = [{'koala_risk':[699]},{'usercenter':[500]},{'risk':[
case_number_case_fangkuan = [{'ka_koala_loan':[801,818,802,798,799,800,820]}]
[sqldata]
sqldata = ['success', '159866', '739c417e-a250-40a4-9f8e-7c7eed568bd3', 0, 'true', 1606752000000, 100010]
sqldata = ['e9b16694-e126-4358-be34-1efd049a6e9b', '1', '1', '13805327211', '140781196502039883', '寿德水']
......@@ -42,7 +42,7 @@ koala_risk={'testnumer':'case_number_koala_risk',
'casename':'koala_risk','platform':'考拉','reportname':'考拉风审','projectId':43,'psid':7}
passportapi={'testnumer':'cases_number1',
passportapi={'testnumer':'cases_numbertemp',
'casename':'passportapi','platform':'主流程','reportname':'主流程进件','projectId':29,'psid':4}
newhetong={'testnumer':'case_number_newhetong',
......
......@@ -158,17 +158,19 @@ if __name__ == '__main__':
##根据name值,从cases_mapping文件找对应的key
name='msg'
name='passportapi'
###########################
# name='account'
###############
# name='sidecar'
#'account' or 'configuration_center'or
# 串流程
name='case_fengkong'
# name='case_fangkuan'
# ############
......
......@@ -14,7 +14,7 @@ from blueprints.tools.dealbody import requesturl,dealbodyHeaderType,deal_globalP
from blueprints.tools.rwKeyData import rwKeyData
import requests,jsonpath,re,json,os,pickle
from blueprints.settings import testConfig,qaConfig,ka2Config,qa2Config,test1Config,qa3Config,msgConfig
import warnings,demjson,base64,urllib3,time
import warnings,demjson,base64,urllib3,time,html
from blueprints.tools.debugtalk import finalexecaql
from urllib.parse import urlencode
from blueprints.tools.deals import getenv,getenvconfig,dealSign
......@@ -111,7 +111,8 @@ class requestResult:
print("==="*10,sql)
sqlData=delDatabase(self.config,sql,db)
self.keydata.writeKeyData('sqldata','sqldata',sqlData)
print("从表里查到的数据===", sqlData,self.casefile)
print("从表里查到的数据===", sqlData,self.casefile,sql)
casejson = dealbodyHeaderType(self.config, self.casefile, sqlData)
casejson =dealSign(casejson)
......@@ -145,11 +146,14 @@ class requestResult:
header[k] = token or "NOTFOUND"
return _url, method, body, header,casejson.get('param'),commit,isurl
def writeKeyDatafile(self, name, data):
# print(data,name)
def writeKeyDatafile(self,name,data):
#print(data,name)
try:
if data:
if isinstance(data, list):
if isinstance(data,list):
self.keydata.writeKeyData('baseinfo', name, data[0] if data else None)
else:
self.keydata.writeKeyData('baseinfo', name, data if data else None)
......@@ -158,6 +162,9 @@ class requestResult:
def saveKeyData(self,v,savevalue='token',flag=False):
#v可以是请求body,也可以是响应数据
url, type = requesturl(self.config, self.casefile)
......@@ -403,7 +410,7 @@ class requestResult:
pickle.dump(jianrongces, wfile)
result = requests.patch(url, headers=header,verify=False,cookies=pickle.load(file),timeout=self.timeout)
result.encoding = "utf-8"
if re.findall(r'login|signin',url):
try:
......@@ -435,21 +442,26 @@ class requestResult:
unicodetostr = 'u' + "'" + result.text + "'"
try:
print("响应数据===",eval(unicodetostr),"=======end1")
print("<br>")
if '<!DOCTYPE html>' in result.text or len(result.text) >= 3000:
print("响应数据11===", re.findall(r'<title>(.*)</title>',result.text)[0] if re.findall(r'<title>(.*)</title>',result.text) else "html文本略" + "........", "=======end3")
print("<br>")
else:
print("响应数据1===",eval(unicodetostr),"=======end1")
print("<br>")
except:
try:
print("响应数据===",result.json(),"=======end2")
print("响应数据2===",result.json(),"=======end2")
print("<br>")
except:
except Exception as e:
if '<!DOCTYPE html>' in result.text or len(result.text)>=3000:
print("响应数据===", result.text[0:100]+"........","=======end3")
print("响应数据3===",re.findall(r'<title>(.*)</title>',result.text)[0] if re.findall(r'<title>(.*)</title>',result.text) else "html文本略"+"........","=======end3")
print("<br>")
else:
print("响应数据===",result.text,"=======end4")
print("响应数据4===",result.text[0:10],"=======end4")
print("<br>")
......@@ -467,7 +479,7 @@ class requestResult:
# return result.text
except (urllib3.exceptions.ReadTimeoutError, requests.exceptions.ReadTimeout):
print("响应数据===", self.person_timeout(),"=======end")
print("响应数据5===", self.person_timeout(),"=======end")
print("<br>")
return self.person_timeout()
......@@ -668,14 +680,18 @@ if __name__ == '__main__':
#cases_number= [323, 382, 383, 384, 385,361, 402, 403, 404, 405,401]
cases_number=[699]
#cases_number = [369,370,409,373]
#cases_number=[358, 359, 360,323, 382, 383, 384, 385,361, 402, 403, 404, 405,401,399,407,367,368,371,372,374,375,376,378,363,364,369,370]
t = '.json,'.join([str(i) for i in cases_number]) + ".json"
# casefile = [{'passportapi':['323.json', '382.json','383.json', '384.json', '385.json']},{'payment': t.split(',')}]
casefile =[{'koala_risk': t.split(',')}]
#casefile = [{'passportapi': t.split(',')}]
#print(casefile)
......
......@@ -17,6 +17,7 @@ class maintest(unittest.TestCase):
suite.addTest(testcase_klass(name, config=config))
return suite
<<<<<<< HEAD
class koala_risk0(maintest):
def test_100(self):
res1=requestResult(self.config,'/Users/jiazhaopu/QGjobs/autointerface/testCase/koala_risk/699.json')
......@@ -128,6 +129,13 @@ class koala_risk3(maintest):
res1=requestResult(self.config,'/Users/jiazhaopu/QGjobs/autointerface/testCase/koala_risk/671.json')
res,finalresult=res1.requestJson()
t=readCaseFile('/Users/jiazhaopu/QGjobs/autointerface/testCase/koala_risk/671.json').get('result')
=======
class passportapi0(maintest):
def test_100(self):
res1=requestResult(self.config,'/Users/dm/Desktop/python_script/autoInterface/testCase/passportapi/373.json')
res,finalresult=res1.requestJson()
t=readCaseFile('/Users/dm/Desktop/python_script/autoInterface/testCase/passportapi/373.json').get('result')
>>>>>>> c6543e077b461c175b95087c7f88cdabcbe8e6a1
r=0 if 0 in finalresult and len(finalresult)>0 else 1
if r:
self.detail=res1.keyoption()+('Success',)
......
......@@ -257,10 +257,12 @@ def zentaopms_data(panda_name,projectId,psid):
if __name__ == "__main__":
names=['ka_koala_repay','koala_risk','ka_koala_loan','risk']
# names = ['risk']
# names=['zhongtai_hetong','msg','configuration_center']
for name in names:
projectname=project_mapping.get(name)
panda_name=projectname.get('casename') or name
......
......@@ -3,7 +3,9 @@
"commit": "提现(支持绑卡)(POST)",
"url": "/v1/loan/submit",
"casename": "token",
"sql": "select b.`user_id`,c.`tmpl_path`,\r\n'测试借款用途'\r\n as loanPurpose \r\nfrom `xyqb`.`quota_credit` b\r\ninner join xyqb.funding_contract c\r\nwhere b.`order_no`='{{applyno}}'\r\nand c.`funding_corp_id`=100010;",
"db": "xyqb",
"result": {
"code": "0"
......
......@@ -13,4 +13,6 @@
"header": {
"Content-Type": "application/x-www-form-urlencoded"
}
}
......@@ -23,4 +23,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -12,4 +12,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -12,4 +12,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -22,4 +22,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -24,4 +24,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -22,4 +22,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -21,4 +21,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -21,4 +21,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -22,4 +22,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
{
"method": "POST",
"commit": "新增/修改消息模板-修改(POST)",
"url": "/middle_office/template/modify",
"url": "/middle_office/template",
"casename": "token",
"sql": "select id,concat('测试',content), concat('测试',title) from msg.msg_template where LOCATE('测试',content)>0 order by rand() limit 1;",
"db": "msg",
......@@ -26,4 +26,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -22,4 +22,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
{
"method": "POST",
"commit": "新增/修改消息模板-新增(POST)",
"url": "/middle_office/template/modify",
"url": "/middle_office/template",
"casename": "token",
"result": {
"code": "0"
......@@ -20,4 +20,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -19,4 +19,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -20,4 +20,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -19,4 +19,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -19,4 +19,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -19,4 +19,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -25,4 +25,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -12,4 +12,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -12,4 +12,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -22,4 +22,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -25,4 +25,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -22,4 +22,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -20,4 +20,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -26,4 +26,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -18,4 +18,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -15,4 +15,4 @@
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
}
......@@ -39,4 +39,4 @@
"address": "fakeinfo('address')",
"email": "fakeinfo('email')"
}
}
\ No newline at end of file
}
......@@ -14,4 +14,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -23,4 +23,4 @@
},
"db": "xyqb",
"sql": "select u.uuid,l.id from xyqb_user.user u inner join xyqb.loan_application_history l on u.id=l.user_id where u.phone_no='%s' order by l.id desc limit 1;"
}
\ No newline at end of file
}
......@@ -27,4 +27,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -14,4 +14,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -13,4 +13,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -12,4 +12,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -17,4 +17,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -23,4 +23,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -20,4 +20,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -17,4 +17,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -23,4 +23,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -16,4 +16,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -15,4 +15,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -11,4 +11,4 @@
"code": "0000"
},
"type": "mapi"
}
\ No newline at end of file
}
......@@ -11,4 +11,4 @@
"code": "0000"
},
"type": "mapi"
}
\ No newline at end of file
}
......@@ -18,4 +18,4 @@
},
"db": "payment_center",
"sql": "select a.id from payment_center.bank_card a \r\njoin payment_center.user b on a.user_id=b.id \r\nwhere b.xyqb_uid in (select id from xyqb_user.user where phone_no='{{phone_no}}');"
}
\ No newline at end of file
}
......@@ -17,4 +17,4 @@
"db": "payment_center",
"sql": "select id,`bank_card_id` from payment_center.card_bind_info where \r\nuser_id in (select id from payment_center.user where xyqb_uid in (select id from xyqb_user.user where phone_no='{{phone_no}}')) order by id desc limit 1;",
"isurl": "1"
}
\ No newline at end of file
}
......@@ -10,4 +10,4 @@
"code": "0000"
},
"type": "mapi"
}
\ No newline at end of file
}
......@@ -14,4 +14,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -11,4 +11,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -16,4 +16,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -13,4 +13,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -15,4 +15,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -15,4 +15,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -15,4 +15,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -15,4 +15,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -13,4 +13,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -13,4 +13,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -13,4 +13,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -17,4 +17,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -14,4 +14,4 @@
"result": {
"code": "0000"
}
}
\ No newline at end of file
}
......@@ -10,4 +10,4 @@
"code": "0000"
},
"type": "mapi"
}
\ No newline at end of file
}
......@@ -7,4 +7,4 @@
"param": {
"namespace": "{{NAMESPACE}}"
}
}
\ No newline at end of file
}
......@@ -7,4 +7,4 @@
"param": {
"namespace": "{{namespace}}"
}
}
\ No newline at end of file
}
......@@ -7,4 +7,4 @@
"param": {
"namespace": "{{namespace}}"
}
}
\ No newline at end of file
}
......@@ -7,4 +7,4 @@
"param": {
"namespace": "{{namespace}}"
}
}
\ No newline at end of file
}
{
"method": "post",
"commit": "mo分配资产计划(post)",
"url": "/external/test/funding/plan/save",
"casename": "token",
"body": {
"fundCorpId": "{{fundcorpid}}",
"planDate": "%s",
"maxAssignAmount": "10000000",
"maxLoanAmount": "10000000",
"maxLoanPeople": "1000",
"maxAssignPeople": "1000",
"priorityLevel": "1"
},
"sql": "SELECT concat(date(now()))",
"header": {
"Content-Type": "application/x-www-form-urlencoded",
"x-auth-token": "opapitoken"
},
"type": "moclotho",
"result": {
"code": "0000"
}
}
{
"method": "post",
"commit": "mo资金方不限制配置(post)",
"url": "/external/test/funding/policy/save",
"casename": "token",
"body": {
"fundCorpId": "{{fundcorpid}}",
"minQgScore": "-1",
"maxQgScore": "-1",
"assignTimes": "",
"productType": "{{productid}}",
"pickProduct": "",
"fetchConfig": "0:04",
"autoLoanFetchConfig": "0:03",
"priorityChannel": "",
"banChannel": "",
"loanTimes": "0:00-23:59",
"onlyChannel": "159439",
"isAutoAssign": "true",
"isAutoLoan": "true",
"isAutoFetch": "true",
"autoLoanFetch": "true"
},
"sql": "SELECT funding_corp_id from xyqb.funding_corp_policy order by rand() limit 1;",
"header": {
"Content-Type": "application/x-www-form-urlencoded",
"x-auth-token": "opapitoken"
},
"type": "moclotho",
"nextstep": "['productid']",
"result": {
"code": "0000"
}
}
......@@ -31,4 +31,4 @@
"header": {
"Content-Type": "application/x-www-form-urlencoded"
}
}
}
\ No newline at end of file
......@@ -23,4 +23,4 @@
"header": {
"Content-Type": "application/x-www-form-urlencoded"
}
}
}
\ No newline at end of file
......@@ -22,4 +22,4 @@
"header": {
"Content-Type": "application/x-www-form-urlencoded"
}
}
}
\ No newline at end of file
......@@ -24,4 +24,4 @@
"header": {
"Content-Type": "application/x-www-form-urlencoded"
}
}
}
\ No newline at end of file
......@@ -34,4 +34,4 @@
"header": {
"Content-Type": "application/x-www-form-urlencoded"
}
}
}
\ No newline at end of file
......@@ -32,4 +32,4 @@
"header": {
"Content-Type": "application/x-www-form-urlencoded"
}
}
}
\ No newline at end of file
......@@ -22,4 +22,4 @@
"header": {
"Content-Type": "application/x-www-form-urlencoded"
}
}
}
\ No newline at end of file
......@@ -34,4 +34,4 @@
"header": {
"Content-Type": "application/x-www-form-urlencoded"
}
}
}
\ No newline at end of file
......@@ -19,4 +19,4 @@
"header": {
"Content-Type": "application/x-www-form-urlencoded"
}
}
}
\ No newline at end of file
......@@ -16,4 +16,4 @@
"header": {
"Content-Type": "application/x-www-form-urlencoded"
}
}
}
\ No newline at end of file
......@@ -16,4 +16,4 @@
"header": {
"Content-Type": "application/x-www-form-urlencoded"
}
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment