def test01_tender_done(self): # 1、注册图片验证码接口 self.reg_login.api_get_img_code(123123) # 2、注册手机验证码 self.reg_login.api_get_sms_code("13600001111", "8888") # 3、注册 r = self.reg_login.api_post_register("13600001111", "test123", "8888", "666666", None) print("-->>>>>注册:", r.json()) # 4、登录 r = self.reg_login.api_post_login("13600001111", "test123") print("-->>>>>登录:",r.json()) # 5、请求开户 result = ApiGet.get_apitrust(self.session).api_trust_register() # 6、三方开户 r = html_parser(result) self.session.post(r[0], r[1]) # 7、获取充值验证码 ApiGet.get_apitrust(self.session).api_trust_verify_code() # 8、请求充值 result = ApiGet.get_apitrust(self.session).api_trust_recharge(1000, 8888) r = html_parser(result) self.session.post(r[0], r[1]) # 9、请求投资 r = ApiGet.get_apitender(self.session).api_tender() # 10、三方投资 r = html_parser(result) result = self.session.post(r[0], r[1]) assert "OK" in result.text
def test02_get_approve(self, status, expect_msg): if status == "已登录": # 调用登录 ApiGet.get_apireglogin(self.session).api_post_login( "13600001111", "test123") # 调用查询方法 result = self.approve.api_get_approve() print("查询结果为 :", result.json()) try: # 断言 assert expect_msg in result.json().get("phone") # 记录日志 log.info("认证查询接口断言成功!,断言内容:{}".format(expect_msg)) except Exception as e: # 日志 log.error(e) # 抛异常 raise elif status == "未登录": # 调用查询方法 result = self.approve.api_get_approve() try: # 断言 assert "立即登录" in result.text # 记录日志 log.info("认证查询接口断言成功!,断言内容:{}".format(expect_msg)) except Exception as e: # 日志 log.error(e) # 抛异常 raise
def setup(self): # 获取session self.session = requests.session() # 获取ApiTender实例 self.tender = ApiGet.get_apitender(self.session) # 登录 ApiGet.get_apireglogin(self.session).api_post_login( "13600001111", "test123")
def setup(self): # 1、获取session self.session = requests.session() # 2、获取ApiGet self.trust = ApiGet.get_apitrust(self.session) # 3、调用登录 ApiGet.get_apireglogin(self.session).api_post_login( "13600001111", "test123")
def test01_approve(self, realname, card_id, expect_status): # 1、获取ApiRegLogin对象并调用登录 ApiGet.get_apireglogin(self.session).api_post_login( "13600001111", "test123") # 2、认证 result = self.approve.api_approve(realname=realname, card_id=card_id) try: # 断言 common_assert(result, status=expect_status) # 日志结果 log.info("断言成功,断言信息:".format(expect_status)) except Exception as e: # 错误日志 log.error(e) # 抛异常 raise
def setup(self): # 获取session self.session = requests.session() # 获取ApiApprove对象 self.approve = ApiGet.get_apiapprove(self.session)
def setup(self): # 获取session self.session = requests.session() # 获取ApiLoginReg对象 self.reg_login = ApiGet.get_apireglogin(self.session)