def testBankValid(self): """绑定银行卡""" self.cls = common.getXls("testCase.xlsx", "test1") self.log = log.get_log() self.readConfig = ReadConfig.ReadConfig() self.logger = self.log.getLogger() self.Http = configHttp.ConfigHttp() self.HttpUrl = self.Http.setUrl(self.cls.get(9).get("url")) self.logger.info(self.HttpUrl) TempParams = json.loads(self.cls.get(9).get("params")) self.readConfig.setReslConfig("channelId", common.getChannelId()) #TempParams["channelId"] = self.readConfig.getReslConfig("channelId") TempParams["mobile"] = self.readConfig.getReslConfig("mobile") TempParams["idCard"] = self.readConfig.getReslConfig("idnum") TempParams["name"] = self.readConfig.getReslConfig("realname") self.params = json.dumps(TempParams) self.logger.info(self.params) self.Http.setParams(self.params) self.Http.setHeaders("jwt", self.readConfig.getReslConfig("jwt")) self.r = self.Http.post() self.r.status_code self.r.encoding = 'utf-8' self.logger.info("result-----------", self.r.json().get("errorCode")) assert self.r.status_code == 200, "请求失败" assert self.r.json().get("errorCode") == "0000000", "响应失败"
def testImg1(self): """获取图形验证码""" self.cls = common.getXls("testCase.xlsx", "test1") self.log = log.get_log() self.logger = self.log.getLogger() self.Http = configHttp.ConfigHttp() self.HttpUrl = self.Http.setUrl(self.cls.get(0).get("url")) self.logger.info(self.HttpUrl) self.Http.setParams(self.cls.get(0).get("params")) self.r = self.Http.get() self.r.status_code self.r.encoding = 'utf-8' self.r.text self.logger.info(self.r.text) self.logger.info(self.r.status_code) self.imgCodeId = self.r.json().get("data").get("imgCodeId") self.confige.setReslConfig("imgCodeId", self.imgCodeId)
def testImg(self): """获取图形验证码""" self.cls = common.getXls("testCase.xlsx", "test1") self.log = log.get_log() self.logger = self.log.getLogger() self.Http = configHttp.ConfigHttp() self.HttpUrl = self.Http.setUrl(self.cls.get(0).get("url")) self.logger.info(self.HttpUrl) self.Http.setParams(self.cls.get(0).get("params")) self.r = self.Http.get() self.r.status_code self.r.encoding = 'utf-8' self.logger.info("result-----------", self.r.json().get("errorCode")) assert self.r.status_code == 200, "请求失败" assert self.r.json().get("errorCode") == "0000000", "响应失败" self.imgCodeId = self.r.json().get("data").get("imgCodeId") self.confige.setReslConfig("imgCodeId", self.imgCodeId)
def testLogin(self): """登陆""" self.cls = common.getXls("testCase.xlsx","test1") self.log = log.get_log() self.logger = self.log.getLogger() self.Http = configHttp.ConfigHttp() self.HttpUrl = self.Http.setUrl(self.cls.get(4).get("url")) self.logger.info(self.HttpUrl) TempParams = json.loads(self.cls.get(4).get("params")) self.readConfig = readConfig() TempParams["mobile"] = self.readConfig.getReslConfig("mobile") self.params =json.dumps(TempParams) self.logger.info(self.params) self.Http.setParams(self.params) self.r = self.Http.post() self.r.encoding = 'utf-8' self.logger.info("result-----------",self.r.json().get("errorCode")) assert self.r.status_code == 200,"请求失败" assert self.r.json().get("errorCode") == "0000000","响应失败" assert self.r.status_code == 200
def testApply(self): """身份认证""" self.cls = common.getXls("testCase.xlsx", "test1") self.log = log.get_log() self.logger = self.log.getLogger() self.Http = configHttp.ConfigHttp() self.HttpUrl = self.Http.setUrl(self.cls.get(5).get("url")) self.logger.info(self.HttpUrl) TempParams = json.loads(self.cls.get(5).get("params")) self.readConfig = readConfig() TempParams["idNum"] = self.readConfig.getReslConfig("idnum") TempParams["realName"] = self.readConfig.getReslConfig("realname") self.params = json.dumps(TempParams) self.logger.info(self.params) self.Http.setParams(self.params) self.Http.setHeaders("jwt", self.readConfig.getReslConfig("jwt")) self.r = self.Http.post() self.r.status_code self.r.encoding = 'utf-8' self.logger.info("result-----------", self.r.json().get("errorCode")) assert self.r.status_code == 200, "请求失败" assert self.r.json().get("errorCode") == "0000000", "响应失败"