def test_1_oneDragon(self): # -------------------------首页信息查询(带token和userNo)------------------------------ urlStr = consts.getEnviron(self.ENV) + consts.APPL_SUMMARY_QUERY paramIn = Gatlin.packApplSummaryQueryParam() paramIn['userNo'] = self.context['userNo'] # 取上下文的userNo,下同 paramIn['token'] = self.context['token'] Gatlin.printParam(json.dumps(paramIn)) self.ret = json.loads(Gatlin.myJsonPost(urlStr, paramIn).text)
def test_2_oneDragon(self): # -------------------------首页信息查询(带token和userNo)------------------------------ urlStr = consts.getEnviron(self.ENV) + consts.REFUND_RECORD_QUERY paramIn = packRefundRecordQueryParam() paramIn['userNo'] = self.context['userNo'] # 取上下文的userNo,下同 paramIn['token'] = self.context['token'] Gatlin.printParam(paramIn) self.ret = json.loads(Gatlin.myJsonPost(urlStr, paramIn).text)
def test_3_oneDragon(self): # -------------------------补件信息查询(带token和userNo)------------------------------ urlStr = consts.getEnviron(self.ENV) + consts.SUPPLEMENT_LIST_QUERY paramIn = packSupplementlistQWueryParam() paramIn['userNo'] = self.context['userNo'] # 取上下文的userNo,下同 paramIn['token'] = self.context['token'] paramIn['custNo'] = self.context['custNo'] Gatlin.printParam(paramIn) self.ret = json.loads(Gatlin.myJsonPost(urlStr, paramIn).text)
def packRefundRecordQueryParam(paramIn): paramOut = params.genericPackParam() paramOut["method"] = consts.REFUND_RECORD_QUERY biz = {} biz['contractNo'] = paramIn['contractNo'] biz['custNo'] = paramIn['custNo'] biz['loanNo'] = paramIn['loanNo'] biz['mobileNo'] = paramIn['mobileNo'] paramOut["bizContent"] = str(biz) # 业务数据 Gatlin.printParam(paramOut) return paramOut
def packSupplementlistQWueryParam(): paramIn = params.genericPackParam() paramIn["method"] = consts.SUPPLEMENT_LIST_QUERY biz = {} biz['mobileNo'] = '+6308062400111' biz['custNo'] = 'CT6829156253144350720' biz['loanNo'] = '6829491650026262528' biz['contractNo'] = '6829233129166528512' paramIn["bizContent"] = str(biz) # 业务数据 Gatlin.printParam(paramIn) return paramIn
def packRefundRecordQueryParam(): paramIn = params.genericPackParam() paramIn["method"] = consts.REFUND_RECORD_QUERY biz = {} biz['contractNo'] = '6851471332867129344' biz['custNo'] = 'CT6851459341117042688' biz['loanNo'] = '6857427969591234560' biz['mobileNo'] = '+6308132000071' paramIn["bizContent"] = str(biz) # 业务数据 Gatlin.printParam(paramIn) return paramIn
def packLoginParam(mobile, bytePwd): paramIn = params.genericPackParam() paramIn["method"] = consts.LOGIN biz = {} biz['loginType'] = "ORIGIN" biz['mobileNo'] = mobile # 手机号 biz['password'] = str(security.encrypt(bytePwd), 'utf-8') biz['geoInfo'] = str(geo.packGeo()) # 地理geo必传,否则会落库报latitude非空键异常 paramIn["bizContent"] = str(biz) # 业务数据 Gatlin.printParam(paramIn) return paramIn
def stickyWalk(self): print("---HERE WE GO!---") if not self.curMethod: return while 1: getattr(self, self.curMethod)() Gatlin.printReturn(json.loads(self.ret)) if self.nextMethod: self.curMethod = self.nextMethod else: print("---HERE WE STOP!---") break
def call_out(self): GLOBAL_ENV = self.context['environ'] if "mock" in GLOBAL_ENV and GLOBAL_ENV["mock"]: # mock开关打开 return ENV = self.context['environ']['env'] METHOD = self.context['environ']['nodeName'] url_str = consts.getEnviron(ENV) + consts.getMethod(METHOD) res = Gatlin.myJsonPost(url_str, self.context['request']) self.context['response'] = json.loads(res.text)
def setUpClass(self): print('STARTING...') self.ENV = "PH_DEV" # ~~~~~~~~~~~~~~~~~~~~~~这里改环境!!!~~~~~~~~~~~~~~~~~~~~~~ security.init(self.ENV) # 初始化加密的公私钥 self.context = {} # 初始化上下文 loginPrepare = packLoginParam( '+6308062400111', b'123456') # ~~~~~~~~~~~~~~~~~~~~~~这里改用户!!!~~~~~~~~~~~~~~~~~~~~~~ urlStr = consts.getEnviron(self.ENV) + consts.LOGIN res = Gatlin.myJsonPost(urlStr, loginPrepare) retJson = json.loads(res.text) Gatlin.get_pretty_print(retJson) token = retJson['data']['token'] userNo = retJson['data']['userNo'] # 获得userNo mobileNo = retJson['data']['mobileNo'] # 获得mobileNo custNo = retJson['data']['custNo'] # 获得mobileNo print("Fetch LOGIN Token", token) self.context['token'] = token # token放入上下文 self.context['userNo'] = userNo # userNo放入上下文 self.context['mobileNo'] = mobileNo # userNo放入上下文 self.context['custNo'] = custNo # userNo放入上下文
def myInit(self): print('STARTING...') self.ENV = self.paramIn['environ'] security.init(self.ENV) # 初始化加密的公私钥 self.context = {} # 初始化上下文 loginPrepare = packLoginParam(self.paramIn) urlStr = consts.getEnviron(self.ENV) + consts.LOGIN res = Gatlin.myJsonPost(urlStr, loginPrepare) retJson = json.loads(res.text) token = retJson['data']['token'] userNo = retJson['data']['userNo'] # 获得userNo print("Fetch LOGIN Token", token) self.context['token'] = token # token放入上下文 self.context['userNo'] = userNo # userNo放入上下文 self.curMethod = "biz1"
def myInit(self): print('STARTING...') self.ENV = self.paramIn['env'] security.init(self.ENV) # 初始化加密的公私钥 self.context = {} # 初始化上下文 regPrepare = packRegisterParam(self.paramIn) print(regPrepare) urlStr = consts.getEnviron(self.ENV) + consts.REGISTER res = Gatlin.myJsonPost(urlStr, regPrepare) retJson = json.loads(res.text) print(retJson) token = retJson['data']['token'] userNo = retJson['data']['userNo'] # 获得userNo print("Fetch REGISTER Token", token) self.context['token'] = token # token放入上下文 self.context['userNo'] = userNo # userNo放入上下文 self.curMethod = "biz4"
def mandatoryWalk(self, orderMethods): print("---MANDATORY BEGINS---") for orderMethod in orderMethods: getattr(self, orderMethod)() Gatlin.printReturn(json.loads(self.ret)) print("---MANDATORY ENDS---")
def refundRecordQuery(self): refundPrepare = packRefundRecordQueryParam(self.paramIn) urlStr = consts.getEnviron(self.ENV) + consts.REFUND_RECORD_QUERY self.ret = Gatlin.myJsonPost(urlStr, refundPrepare).text
def tearDown(self): # 每个测试用例执行之后做操作 Gatlin.printReturn(self.ret) print('=' * 150)