Commit b7c4edc9 authored by 桂秋月's avatar 桂秋月

增加部分debugtalk逻辑

parent b5f97296
...@@ -11,7 +11,7 @@ finalenv = 1 ...@@ -11,7 +11,7 @@ finalenv = 1
usered = qa usered = qa
defaluttime = 2 defaluttime = 2
timeout = 20 timeout = 20
phone_no = 13683241115 phone_no = 13532956108
environment = qa3 environment = qa3
term = 6 term = 6
amount = 10000 amount = 10000
...@@ -29,12 +29,13 @@ totalloanamount = 1004.61 ...@@ -29,12 +29,13 @@ totalloanamount = 1004.61
termno = 9 termno = 9
verificationid = BK751417141686117278698537 verificationid = BK751417141686117278698537
applyno = AN000000144618983447142400 applyno = AN000000144618983447142400
randomstr = eKgdOZNDqP9LGjv8IrYfS04wk6C1
[globalvar] [globalvar]
password = 123456aaa password = 123456aaa
biztype = 0 biztype = 0
token = eb298e58-b438-4437-ab29-70973e7210a2 token = eb298e58-b438-4437-ab29-70973e7210a2
passportapitoken = 9b5b6b22-8d8a-4097-98c3-8f0aa9e98621 passportapitoken = c34955cc-2384-4345-9b1e-4dc1038ff0d5
opapitoken = 5375b6c5-527e-4c3a-8c66-b9ef96a7412d opapitoken = 5375b6c5-527e-4c3a-8c66-b9ef96a7412d
cardnoprovider = ICBC cardnoprovider = ICBC
apitoken = ed02234f-27e5-4f50-9cda-3457ab98fce0 apitoken = ed02234f-27e5-4f50-9cda-3457ab98fce0
...@@ -50,7 +51,7 @@ requestid = 63119890137088 ...@@ -50,7 +51,7 @@ requestid = 63119890137088
vcode = 238345 vcode = 238345
applyno = AN000000143183669801000960 applyno = AN000000143183669801000960
voicetoken = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1ODgxNTE1OTgsInVzZXJuYW1lIjoidHgueHlxYiJ9.W4fKn-tdbOORELBfUd6KOjrygjzWWFY0zf6dmcqsjiI voicetoken = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1ODgxNTE1OTgsInVzZXJuYW1lIjoidHgueHlxYiJ9.W4fKn-tdbOORELBfUd6KOjrygjzWWFY0zf6dmcqsjiI
logindata = {'uuid': '1ba1de90-172c-4f2d-a2be-a6771962a063', 'channelId': 159866, 'productId': '1', 'channelType': '1', 'source': 2, 'phoneNo': '13255741029', 'idCard': '152500193108182914', 'name': '周丹', 'compatibleExtData': {}} logindata = phone=13532956108
[testsuit] [testsuit]
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_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]}]
...@@ -88,10 +89,5 @@ case_number_case_tixian = [{'ka_koala_loan':[801,818,798,799,800,802,820]}] ...@@ -88,10 +89,5 @@ case_number_case_tixian = [{'ka_koala_loan':[801,818,798,799,800,802,820]}]
case_number_case_fangkuan = [{'ka_koala_loan':[835]},{'zijin':[824,822]}] case_number_case_fangkuan = [{'ka_koala_loan':[835]},{'zijin':[824,822]}]
[sqldata] [sqldata]
sqldata = ['AN000000140595662094934016'] sqldata = ['xyqb', 4843, 'oTQGos9gkdczK4qdXQDl6ZAfyYv8', '18211020323']
[circleData]
circledata = [(1,), (2,)]
circleflag = 1
circleparam = 1
No preview for this file type
...@@ -36,11 +36,11 @@ class requestResult: ...@@ -36,11 +36,11 @@ class requestResult:
#setGloablValue(self.keydata,self.casefile) #setGloablValue(self.keydata,self.casefile)
try: try:
setup_step(self.casefile) setup_step(self.config,self.casefile)
self.casefile = deal_globalParam(self.config, self.casefile) self.casefile = deal_globalParam(self.config, self.casefile)
except: except:
self.casefile = deal_globalParam(self.config, self.casefile) self.casefile = deal_globalParam(self.config, self.casefile)
setup_step(self.casefile) setup_step(self.config,self.casefile)
#print('*****',self.casefile) #print('*****',self.casefile)
self.casefilename=casefile self.casefilename=casefile
...@@ -702,7 +702,7 @@ if __name__ == '__main__': ...@@ -702,7 +702,7 @@ if __name__ == '__main__':
cases_number=[787] cases_number=[787]
# cases_number=[753] # cases_number=[753]
cases_number=[867] cases_number=[874]
#cases_number = [369,370,409,373] #cases_number = [369,370,409,373]
...@@ -716,7 +716,7 @@ if __name__ == '__main__': ...@@ -716,7 +716,7 @@ if __name__ == '__main__':
casefile = [{'ka_koala_repay': t.split(',')}] casefile = [{'ka_koala_repay': t.split(',')}]
casefile =[{'trade': t.split(',')}] casefile =[{'usercenter': t.split(',')}]
#print(casefile) #print(casefile)
......
...@@ -52,6 +52,9 @@ class baseConfig: ...@@ -52,6 +52,9 @@ class baseConfig:
voice='http://robotweb.q-gp.com' voice='http://robotweb.q-gp.com'
Sidecar='http://mo-sidecar-qa3.liangkebang.net' Sidecar='http://mo-sidecar-qa3.liangkebang.net'
def __str__(self):
return self.__str__()
......
...@@ -90,7 +90,7 @@ def deal_globalParam(config,param): ...@@ -90,7 +90,7 @@ def deal_globalParam(config,param):
except Exception as e: except Exception as e:
pass pass
print('++++++',e) #print('++++++',e)
#print("param=====",param) #print("param=====",param)
if isinstance(temp_param,dict): if isinstance(temp_param,dict):
return json.loads(param) return json.loads(param)
...@@ -143,11 +143,16 @@ def setGloablValue(keydata,casefile): ...@@ -143,11 +143,16 @@ def setGloablValue(keydata,casefile):
keydata.writeKeyData('baseinfo', 'productid', json.loads(productids)[0]) keydata.writeKeyData('baseinfo', 'productid', json.loads(productids)[0])
def setup_step(casejson): def setup_step(config,casejson):
setup=casejson.get('setup') setup=casejson.get('setup')
if setup: if setup:
for k,v in setup.items(): for k,v in setup.items():
try: try:
if 'config' in v:
ruleconfig = re.findall(r"config=(.*)'", v)
# print(ruleconfig[0], config.__name__, v)
v = v.replace('config={0}'.format(ruleconfig[0]), config.__name__)
# print(k,v) # print(k,v)
tttttt = eval('debugtalk.{0}'.format(v)) tttttt = eval('debugtalk.{0}'.format(v))
# print(body, eval('debugtalk.{0}'.format(v))) # print(body, eval('debugtalk.{0}'.format(v)))
...@@ -481,6 +486,13 @@ def dealrules(config,Alldata,casejson=None,filldata=None): ...@@ -481,6 +486,13 @@ def dealrules(config,Alldata,casejson=None,filldata=None):
try: try:
#print(k,v) #print(k,v)
if body[k]=='%s': if body[k]=='%s':
if 'config' in v:
ruleconfig=re.findall(r"config=(.*)'",v)
#print(ruleconfig[0], config.__name__, v)
v=v.replace('config={0}'.format(ruleconfig[0]),config.__name__)
#print("++++++",v)
body[k]=eval('debugtalk.{0}'.format(v)) body[k]=eval('debugtalk.{0}'.format(v))
#print(body, eval('debugtalk.{0}'.format(v))) #print(body, eval('debugtalk.{0}'.format(v)))
except: except:
...@@ -528,7 +540,7 @@ def dealrules(config,Alldata,casejson=None,filldata=None): ...@@ -528,7 +540,7 @@ def dealrules(config,Alldata,casejson=None,filldata=None):
try: try:
#print(k,v) #print(k,v)
tttttt=eval('debugtalk.{0}'.format(v)) tttttt=eval('debugtalk.{0}'.format(v))
#print(body, eval('debugtalk.{0}'.format(v))) print(body, eval('debugtalk.{0}'.format(v)))
except: except:
#pass #pass
raise Exception("执行rule规则出错,确定debugtalk.py文件中是否存在可执行函数:{0}".format(v)) raise Exception("执行rule规则出错,确定debugtalk.py文件中是否存在可执行函数:{0}".format(v))
......
...@@ -9,6 +9,7 @@ import faker,datetime,time,random,requests ...@@ -9,6 +9,7 @@ import faker,datetime,time,random,requests
import base64,json,numpy_financial,jsonpath import base64,json,numpy_financial,jsonpath
from decimal import Decimal from decimal import Decimal
from math import fabs from math import fabs
from blueprints.settings import qa3Config
from urllib.parse import urlencode from urllib.parse import urlencode
from blueprints.tools import rwKeyData from blueprints.tools import rwKeyData
from blueprints.tools import dealDatabase from blueprints.tools import dealDatabase
...@@ -16,7 +17,8 @@ from itertools import product ...@@ -16,7 +17,8 @@ from itertools import product
from blueprints.tools import deals from blueprints.tools import deals
import urllib3 import urllib3
urllib3.disable_warnings() urllib3.disable_warnings()
def fakeinfo(k,flag=1):
def fakeinfo(k,config=qa3Config,flag=1,rlen=8,hasphone=0):
rw = rwKeyData.rwKeyData() rw = rwKeyData.rwKeyData()
f=faker.Faker(locale='zh_CN') f=faker.Faker(locale='zh_CN')
if k=='username': if k=='username':
...@@ -29,6 +31,27 @@ def fakeinfo(k,flag=1): ...@@ -29,6 +31,27 @@ def fakeinfo(k,flag=1):
return f.email() return f.email()
if k=='phone': if k=='phone':
return f.phone_number() return f.phone_number()
if k=='nophone':
while True:
phone_no=f.phone_number()
sql = 'select id from xyqb_user.user where phone_no=' + phone_no
#config=deals.getenvconfig()
try:
existPhone = dealDatabase.delDatabase(config, sql)
except:
existPhone = dealDatabase.delDatabase(eval(config), sql)
#print("*****",phone_no)
if hasphone:
if existPhone[0]>0:
rw.writeKeyData('baseinfo', 'phone_no', phone_no)
return phone_no
else:
if 0==existPhone[0]:
rw.writeKeyData('baseinfo', 'phone_no', phone_no)
return phone_no
if k=='idno': if k=='idno':
while True: while True:
idno = f.ssn() idno = f.ssn()
...@@ -44,7 +67,10 @@ def fakeinfo(k,flag=1): ...@@ -44,7 +67,10 @@ def fakeinfo(k,flag=1):
if k=='ip': if k=='ip':
return f.ipv4() return f.ipv4()
if k=='random': if k=='random':
return ''.join(random.sample('zyxwvutsrqponmlkjihgfedcbaABCDEFJHIGKLMNOPQRSTUVWSYZ1234567890',8)) t=''.join(random.sample('zyxwvutsrqponmlkjihgfedcbaABCDEFJHIGKLMNOPQRSTUVWSYZ1234567890',rlen))
if rlen==28:
rw.writeKeyData('baseinfo','randomstr',t)
return t
if k.lower()=='cardNo'.lower():#or k.lower()=='cardNoProvider'.lower(): if k.lower()=='cardNo'.lower():#or k.lower()=='cardNoProvider'.lower():
while True: while True:
...@@ -377,7 +403,7 @@ def clear_redis(): ...@@ -377,7 +403,7 @@ def clear_redis():
if __name__ == '__main__': if __name__ == '__main__':
t=fakeinfo('cardNo',flag=0) t=fakeinfo('nophone')
print(t) print(t)
......
...@@ -262,7 +262,7 @@ if __name__ == "__main__": ...@@ -262,7 +262,7 @@ if __name__ == "__main__":
names=['ka_koala_loan','koala_risk','risk'] names=['ka_koala_loan','koala_risk','risk']
# names = ['ka_koala_loan','zijin'] # names = ['ka_koala_loan','zijin']
# names=['zhongtai_hetong','msg','configuration_center'] # names=['zhongtai_hetong','msg','configuration_center']
names=['trade'] names=['usercenter']
......
...@@ -13,4 +13,4 @@ ...@@ -13,4 +13,4 @@
"header": { "header": {
"Content-Type": "application/json" "Content-Type": "application/json"
} }
} }
\ No newline at end of file
{
"method": "POST",
"commit": "小程序用户中心关联接口(POST)",
"url": "/middle_office/applet/relevance",
"casename": "token",
"sql": "select a.app_name,c.id,a.open_id,a.phone_no\r\nfrom xyqb_user.wechat_userinfo a\r\njoin xyqb_user.user b on a.user_id=b.id\r\njoin xyqb.channel c on c.name=a.app_name\r\norder by rand() limit 1;",
"db": "msg",
"execjsonversion": "wx1.0",
"result": {
"code": "0",
"mustexist": "['code', 'businessCode', 'userId']",
"notmustexist": "['msg']"
},
"type": "passportapi",
"body": {
"appName": "%s",
"channelId": "%s",
"openId": "%s",
"mobile": "%s",
"unionId": "",
"nickName": "测试",
"avatarUrl": "http://a3.att.hudong.com/14/75/01300000164186121366756803686.jpg",
"gender": "0",
"country": "北京",
"province": "北京",
"city": "北京",
"language": "ZH"
},
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
{
"method": "POST",
"commit": "小程序用户中心关联接口-正常流程(POST)",
"url": "/middle_office/applet/relevance",
"casename": "token",
"sql": "select a.app_name,c.id,a.open_id,a.phone_no\r\nfrom xyqb_user.wechat_userinfo a\r\njoin xyqb_user.user b on a.user_id=b.id\r\njoin xyqb.channel c on c.name=a.app_name\r\norder by rand() limit 1;",
"db": "msg",
"execjsonversion": "wx1.0",
"result": {
"code": "0",
"mustexist": "['code', 'businessCode', 'userId']",
"notmustexist": "['msg']",
"userId": "select user_id from xyqb_user.wechat_userinfo where open_id={{sqldata_2}}"
},
"type": "passportapi",
"body": {
"appName": "%s",
"channelId": "%s",
"openId": "%s",
"mobile": "%s"
},
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
{
"method": "POST",
"commit": "小程序用户中心关联接口-nophone(POST)",
"url": "/middle_office/applet/relevance",
"casename": "token",
"sql": "select a.app_name,c.id,a.open_id,a.phone_no\r\nfrom xyqb_user.wechat_userinfo a\r\njoin xyqb_user.user b on a.user_id=b.id\r\njoin xyqb.channel c on c.name=a.app_name\r\norder by rand() limit 1;",
"db": "msg",
"execjsonversion": "wx1.0",
"result": {
"code": "0",
"mustexist": "['code', 'businessCode', 'userId']",
"notmustexist": "['msg']",
"userId": "select user_id from xyqb_user.wechat_userinfo where open_id='{{sqldata_2}}'"
},
"rule": {
"mobile": "fakeinfo('nophone','config=qa3config')"
},
"type": "passportapi",
"body": {
"appName": "%s",
"channelId": "%s",
"openId": "%s",
"mobile": "%s"
},
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
{
"method": "POST",
"commit": "小程序用户中心关联接口-newdata(POST)",
"url": "/middle_office/applet/relevance",
"casename": "token",
"sql": "select name,id from xyqb.channel where id>1000 order by rand() limit 1;",
"db": "msg",
"execjsonversion": "wx1.0",
"result": {
"code": "0",
"mustexist": "['code', 'businessCode', 'userId']",
"notmustexist": "['msg']",
"userId": "select user_id from xyqb_user.wechat_userinfo where open_id='{{randomstr}}'",
"exist_a": "select * from xyqb_user.user where id in (select user_id from xyqb_user.wechat_userinfo where open_id='{{randomstr}}')"
},
"rule": {
"mobile": "fakeinfo('nophone','config=qa3config')",
"openId": "fakeinfo('random',rlen=28)"
},
"type": "passportapi",
"body": {
"appName": "%s",
"channelId": "%s",
"openId": "%s",
"mobile": "%s"
},
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
{
"method": "POST",
"commit": "小程序用户中心关联接口-hasphone(POST)",
"url": "/middle_office/applet/relevance",
"casename": "token",
"sql": "select name,id from xyqb.channel where id>1000 order by rand() limit 1;",
"db": "msg",
"execjsonversion": "wx1.0",
"result": {
"code": "0",
"mustexist": "['code', 'businessCode', 'userId']",
"notmustexist": "['msg']",
"userId": "select user_id from xyqb_user.wechat_userinfo where open_id='{{randomstr}}'",
"exist_a": "select * from xyqb_user.user where id in (select user_id from xyqb_user.wechat_userinfo where open_id='{{randomstr}}')"
},
"rule": {
"openId": "fakeinfo('random',rlen=28)"
},
"type": "passportapi",
"body": {
"appName": "%s",
"channelId": "%s",
"openId": "%s",
"mobile": "13683241439"
},
"header": {
"Content-Type": "application/json"
}
}
\ No newline at end of file
{
"method": "post",
"commit": "h5login-zhongtai-register(post)",
"url": "/user/login/fastV1",
"casename": "token",
"body": {
"channelId": "214",
"appChannel": "ios",
"createdFrom": "1",
"btRegisterChannelId": "1",
"dimension": "",
"clickId": ""
},
"header": {
"Authorization": "%s"
},
"type": "passportapi",
"setup": {
"a": "fakeinfo('nophone','config=qa3Config')"
},
"result": {
"code": "0",
"register": "false"
},
"followupWork": {
"aftersql": "saveuserId(\\'user_id\\')",
"beforasql": "select id from xyqb_user.user where phone_no='%s'"
}
}
{
"method": "post",
"commit": "h5login-zhongtai-register(post)",
"url": "/user/login/fastV1",
"casename": "token",
"body": {
"channelId": "214",
"appChannel": "ios",
"createdFrom": "1",
"btRegisterChannelId": "1",
"dimension": "",
"clickId": ""
},
"header": {
"Authorization": "%s"
},
"type": "passportapi",
"setup": {
"a": "fakeinfo('nophone','config=qa3Config','hasphone=1')"
},
"result": {
"code": "0",
"register": "true"
},
"followupWork": {
"aftersql": "saveuserId(\\'user_id\\')",
"beforasql": "select id from xyqb_user.user where phone_no='%s'"
}
}
\ No newline at end of file
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