def api_recharge_all(self): # 1. 获取充值验证码 self.api_recharge_verify_code(12312312) # 2. 调用充值 r = self.api_recharge(1000, 8888) # 3. 三方充值 result = parser_html(r) return self.session.post(url=result[0], data=result[1])
def test02_recharge(self): r = self.trust.api_recharge_code() logger.info("获取充值验证码结果:{}".format(r.status_code)) r = self.trust.api_recharge(100, 8888) print("充值结果", r.text) # 调用第三方充值 result = parser_html(r) logger.info("解析充值数据结果为:{}".format(result)) r = self.session.post(url=result[0], data=result[1]) print("三方充值结果为:", r.text) logger.info("三方充值结果为:{}".format(r.text)) self.assertIn("OK", r.text)
def test03_recharge(self): amount, valicode = 1000 ,8888 # 1. 获取图片验证码 self.api.api_recharge_verify_code(random.random()) # 2. 调用充值接口 self.api.api_recharge(amount,valicode) # 3. 调用三方充值接口 result = parser_html(r) r = self.session.post(url=result[0],data=result[1]) print("三方开户结果为:", r.text) log.info("三方开户的结果为:{}".format(r.text)) self.assertIn("OK", r.text)
def test01_trust(self): # 1. 请求 开户 r = self.api.api_trust() log.info("开户结果为:{}".format(r.json())) print("结果为:", r.json()) try: common_assert(self, r, status=200) except Exception as e: log.error(e) # 2. 调用三方开户 result = parser_html(r) log.info("解析开户数据结果为:{}".format(result)) r = self.session.post(url=result[0],data=result[1]) print("三方开户结果为:", r.text) log.info("三方开户的结果为:{}".format(r.text)) self.assertIn("OK", r.text)
def test02_loan(self): id = 642 amount = 1000 r = self.api.api_loan(id, amount) print("投资接口响应结果为:", r.json()) log.info("投资接口响应结果为:{}".format(r.json())) # 提取html数据 result = parser_html(r) # 调用三方接口 r = self.session.post(url=result[0], data=result[1]) log.info("第三方投资结果为:{}".format(r.text)) try: self.assertIn("OK", r.text) except Exception as e: log.error(e) raise
def test01_trust(self): r = self.trust.api_trust() logger.info("开户结果:{}".format(r.text)) try: common_assert(self, r) except Exception as e: logger.error(e) raise # 调用第三方开户 result = parser_html(r) logger.info("解析开户数据结果为:{}".format(result)) r = self.session.post(url=result[0], data=result[1]) print("三方开户结果为:", r.text) logger.info("三方开户结果为:{}".format(r.text)) self.assertIn("OK", r.text)
def test02_loan(self): id, amount = 874, 100 r = self.loan.api_tender(id, amount) logger.info("投资结果:{}".format(r.text)) print("投资结果", r.text) # 调用第三方投资 result = parser_html(r) logger.info("解析投资数据结果为:{}".format(result)) r = self.session.post(url=result[0], data=result[1]) print("三方投资结果为:", r.text) logger.info("三方投资结果为:{}".format(r.text)) try: self.assertEqual(200, r.status_code) except Exception as e: logger.error(e) raise
def test01(self): # 1. 获取图片验证码 r = self.api_reglog.reg_img_code(random.random()) try: self.assertEqual(200, r.status_code) except Exception as e: logger.error(e) raise # 2. 获取短信验证码 self.api_reglog.reg_sms_code(phone,imgVerifycode,type=type) # 3. 调用注册接口 self.api_reglog.reg(phone, password, imgVerifycode, phone_code, dy_server, invite_phone) # 4. 登录 self.api_reglog.login(phone, password) # 5.判断是否登录 self.api_reglog.islogin() # 6.认证 self.approve.api_approve("张三", "362322199512036344") # 7.查询认证信息 self.approve.api_approve_info() # 8.开户 r =self.trust.api_trust() # 9.调用第三方开户 result = parser_html(r) logger.info("解析开户数据结果为:{}".format(result)) r = self.session.post(url=result[0], data=result[1]) print("三方开户结果为:", r.text) logger.info("三方开户结果为:{}".format(r.text)) self.assertIn("OK", r.text) # 10.充值,第三方充值 r = self.trust.api_recharge_code() logger.info("获取充值验证码结果:{}".format(r.status_code)) r = self.trust.api_recharge(100, 8888) print("充值结果", r.json()) # 调用第三方充值 result = parser_html(r) logger.info("解析充值数据结果为:{}".format(result)) r = self.session.post(url=result[0], data=result[1]) print("三方充值结果为:", r.text) logger.info("三方充值结果为:{}".format(r.text)) self.assertIn("OK", r.text) # 11.调用投资 self.loan.api_loan_info(id) # 12.第三方投资 r = self.loan.api_tender(id, amount) logger.info("投资结果:{}".format(r.json())) print("投资结果", r.json()) # 调用第三方投资 result = parser_html(r) logger.info("解析投资数据结果为:{}".format(result)) r = self.session.post(url=result[0], data=result[1]) print("三方投资结果为:", r.text) logger.info("三方投资结果为:{}".format(r.text)) try: self.assertIn("OK", r.text) except Exception as e: logger.error(e) raise
def api_trust_all(self): # 1. 调用开户 url r = self.api_trust() # 2. 调用三方开户 result = parser_html(r) return self.session.post(url=result[0], data=result[1])
def api_loan_all(self): # 1. 投资 r = self.api_loan(642, 1000) # 2. 三方投资 result = parser_html(r) return self.session.post(url=result[0], data=result[1])