def test04_login(self, keywords, password, expect_code):
        r = self.api.api_login(keywords, password)
        log.info("请求数据:{} 响应数据:{}".format((keywords, password, expect_code),
                                          r.json()))

        print("登陆结果:", r.json())
        if "error" in password:
            log.info("锁定60验证...")
            r = self.api.api_login(keywords, password)
            log.info("请求数据:{} 响应数据:{}".format(
                (keywords, password, expect_code), r.json()))
            print("登陆结果:", r.json())

            r = self.api.api_login(keywords, password)
            log.info("请求数据:{} 响应数据:{}".format(
                (keywords, password, expect_code), r.json()))
            print("登陆结果:", r.json())

            sleep(60)
            r = self.api.api_login("13600001111", "q123456")
            log.info("请求数据:{} 响应数据:{}".format(
                (keywords, password, expect_code), r.json()))
            print("登陆结果:", r.json())

        try:
            common_assert(self, r, response_code=expect_code)
        except Exception as e:
            log.error(e)
            raise
    def test04_login(self,keywords, password, expect_code):
        r = self.api.login(keywords, password)
        logger.info("请求数据:{} 响应数据:{}".format((keywords, password, expect_code), r.json()))

        print("登录结果:", r.json())
        if "error" in password:
            logger.info("锁定60验证...")
            r = self.api.login(keywords, password)
            logger.info("请求数据:{} 响应数据:{}".format((keywords, password, expect_code), r.json()))
            print("登陆结果:", r.json())

            r = self.api.login(keywords, password)
            logger.info("请求数据:{} 响应数据:{}".format((keywords, password, expect_code), r.json()))
            print("登陆结果:", r.json())

            time.sleep(60)
            r = self.api.login("13600001111", "q123456")
            logger.info("请求数据:{} 响应数据:{}".format((keywords, password, expect_code), r.json()))
            print("登陆结果:", r.json())
        try:
            # 4. 断言登录信息
            common_assert(self, r, status_code=expect_code)
        except Exception as e:
            logger.error(e)
            raise
 def test03_register(self, phone4, password, imgVerifyCode, phone_code,
                     dy_server, invite_phone, expect_code, status,
                     description):
     # 1. 获取图片验证码
     self.api.api_img_code(random.random())
     # 2. 获取短信验证码
     self.api.api_sms_code(phone4, imgVerifyCode)
     # 3. 调用注册接口
     r = self.api.api_register(phone4,
                               password,
                               imgVerifyCode,
                               phone_code,
                               dy_server,
                               invite_phone=invite_phone)
     print(r.json())
     log.info("请求数据:{} 响应结果:{}".format(
         (phone4, password, imgVerifyCode, phone_code, dy_server,
          invite_phone, expect_code, status, description), r.json()))
     try:
         # 4. 断言注册信息
         common_assert(self,
                       r,
                       response_code=expect_code,
                       status=status,
                       description=description)
     except Exception as e:
         log.error(e)
         raise
Beispiel #4
0
 def test01_reg_img(self, random, response_code):
     r = self.reg_login.api_register_img_code(random)
     log.info("正在调用 注册图片验证码接口测试方法,响应状态码结果:{}".format(r.status_code))
     print("状态码:", r.status_code)
     print("结果为:", r.text)
     # 调用 公共断言
     common_assert(self, r, response_code=response_code, status_code=None)
 def test07_img_code_random_null(self):
     num = ""
     r = self.api.api_img_code(num)
     log.info("随机数为空获取验证码的响应状态码为:{}".format(r.status_code))
     try:
         common_assert(self, r, response_code=404, status=None)
     except Exception as e:
         log.error(e)
 def test08_img_code_random_str(self):
     num = random.sample("qwerttyuiopasdfghjklzxcvbnm", 8)
     r = self.api.api_img_code("".join(num))
     log.info("随机数为空获取验证码的响应状态码为:{}".format(r.status_code))
     try:
         common_assert(self, r, response_code=400, status=None)
     except Exception as e:
         log.error(e)
 def test04_login(self):
     r = self.api.api_login(phone4, password)
     print("登陆结果:", r.json())
     try:
         common_assert(self, r, description="登录成功")
     except Exception as e:
         log.error(e)
         raise
 def test06_img_code_random_int(self):
     num = random.randint(10000000, 999999999)
     r = self.api.api_img_code(num)
     print("响应状态吗为:", r.status_code)
     log.info("随机整数获取验证码的响应状态码为:".format(r.status_code))
     try:
         common_assert(self, r, status=None)
     except Exception as e:
         log.error(e)
 def test21_login_status_fail(self):
     # 1. 判断是否登录
     r = self.api.api_is_login()
     print("登陆查询结果:", r.json())
     try:
         common_assert(self, r, status=250, description="未登陆")
     except Exception as e:
         log.error(e)
         raise
Beispiel #10
0
 def test01_loan_info(self):
     id = 874
     r = self.loan.api_loan_info(id)
     logger.info("申请投资详情结果:{}".format(r.json()))
     try:
         common_assert(self, r, status=200)
     except Exception as e:
         logger.error(e)
         raise
Beispiel #11
0
    def test02_approve_info(self):
        self.login.login("13600001111", "q123456")
        r = self.approve.api_approve_info()

        try:
            common_assert(self, r, status=None)
        except Exception as e:
            logger.error(e)
            raise
Beispiel #12
0
 def test05_is_login(self, is_login, response_code, status_code, expect_msg):
     if is_login == "已登录":
         # 1.调用登录
         self.reg_login.api_login(keywords="13600001111", password="******")
         # 调用查询登录接口
     r = self.reg_login.api_is_login()
     print("登录状态为:", r.json())
     log.info("正在调用 是否登录接口 测试方法,响应状态码结果:{}".format(r.json()))
     common_assert(self, r, response_code, status_code, expect_msg)
Beispiel #13
0
    def test01_approve(self):
        self.login.login("13600001111", "q123456")
        r = self.approve.api_approve("张三", "362322199512036344")

        try:
            common_assert(self, r, status_code=200)
        except Exception as e:
            logger.error(e)
            raise
 def test18_login_username_not_exists(self):
     r = self.api.api_login(phone7, password)
     print("登陆结果:", r.json())
     log.info("登录·用户不存在结果:{}".format(r.json()))
     try:
         common_assert(self, r, status=100, description="用户不存在")
     except Exception as e:
         log.error(e)
         raise
Beispiel #15
0
 def test06_img_code(self):
     # 调用图片验证码接口
     r = self.api.reg_img_code(random.randint(1, 999999999999))
     # 断言 响应200
     print("响应状态码:", r.status_code)
     try:
         common_assert(self, r, status=None)
     except Exception as e:
         logger.error(e)
         raise
Beispiel #16
0
    def test04_login(self):
        r = self.api.login(phone, password)

        print("登录结果:", r.json())
        try:
            # 4. 断言登录信息
            common_assert(self, r, description="登录成功")
        except Exception as e:
            logger.error(e)
            raise
Beispiel #17
0
 def test01_loan_info(self):
     id = 642
     r = self.api.api_loan_info(id)
     print("投资详情结果:", r.json())
     log.info("投资详情结果为:{}".format(r.json))
     try:
         common_assert(self, r, status=200)
     except Exception as e:
         log.error(e)
         raise
Beispiel #18
0
 def test02_reg_phone(self, phone, imgVerifyCode, response_code, status_code, expect_msg):
     # 1、调用图片验证码
     self.reg_login.api_register_img_code(random.random())
     # 2、调用注册手机验证码接口
     r = self.reg_login.api_phone_code(phone=phone, imgVerifyCode=imgVerifyCode)
     # 3、断言
     print(r.status_code)
     log.info("正在调用 注册手机验证码接口测试方法,响应状态码结果:{}".format(r.json()))
     print("响应结果为:", r.json())
     common_assert(self, r=r, response_code=response_code, status_code=status_code, description=expect_msg)
 def test19_login_pwd_is_null(self):
     password = ""
     r = self.api.api_login(phone7, password)
     print("登陆结果:", r.json())
     log.info("登录·用户不存在结果:{}".format(r.json()))
     try:
         common_assert(self, r, status=100, description="密码不能为空")
     except Exception as e:
         log.error(e)
         raise
Beispiel #20
0
    def test22_is_not_login(self):
        # 2.判断是否登录
        r = self.api.islogin()

        try:
            # 4. 断言登录信息
            common_assert(self, r, status=250, description="您未登陆")
        except Exception as e:
            logger.error(e)
            raise
Beispiel #21
0
 def test01_approve(self, realname, card_id, response_code, status_code,
                    expect_msg):
     # 调用登录
     self.common.get_api_reg_login().api_login("13600001111", "test12345")
     # 调用 认证接口
     r = self.approve.api_approve(realname, card_id)
     log.info("认证结果为:{}".format(r.json()))
     print("认证结果为:", r.json())
     # 断言
     common_assert(self, r, response_code, status_code, expect_msg)
Beispiel #22
0
    def test20_login(self):
        password = ""
        r = self.api.login(phone, password)

        print("登录结果:", r.json())
        try:
            # 4. 断言登录信息
            common_assert(self, r, status=100, description="密码不能为空")
        except Exception as e:
            logger.error(e)
            raise
Beispiel #23
0
    def test19_login(self):
        phone = "134220000"
        r = self.api.login(phone, password)

        print("登录结果:", r.json())
        try:
            # 4. 断言登录信息
            common_assert(self, r, status=100, description="用户不存在")
        except Exception as e:
            logger.error(e)
            raise
Beispiel #24
0
 def test12_sms_code_(self):
     # 2. 获取短信验证码
     r = self.api.reg_sms_code(phone, verifycode)
     logger.info("不请求获取图片验证码 响应数据为:{}".format(r.json()))
     print("不请求获取图片验证码 结果为: ", r.json())
     try:
         # 调用断言方法
         common_assert(self, r, status=100, description="图片验证码错误")
     except Exception as e:
         logger.error(e)
         raise
Beispiel #25
0
 def test07_img_code(self):
     # 调用图片验证码接口
     num = ""
     r = self.api.reg_img_code(num)
     # 断言 响应404
     print("响应状态码:", r.status_code)
     try:
         common_assert(self, r, status_code=404, status=None)
     except Exception as e:
         logger.error(e)
         raise
 def test11_phone_not_img_code_(self):
     # 1. 获取短信验证码
     r = self.api.api_sms_code(phone, imgVerifyCode)
     log.info("不请求图片验证码 响应数据为:{}".format(r.json()))
     print("不请求图片验证码 结果为:", r.json())
     try:
         # 调用断言方法
         common_assert(self, r, status=100, description="图片验证码错误")
     except Exception as e:
         log.error(e)
         raise
Beispiel #27
0
 def test05_is_login(self):
     # 1.调用登录
     self.api.login(phone, password)
     # 2.判断是否登录
     r = self.api.islogin()
     print("登录查询结果:", r.json())
     try:
         common_assert(self, r, description="OK")
     except Exception as e:
         logger.error(e)
         raise
 def test05_is_login(self,phone4,password,expect_code):
     # 1.调用登录
     self.api.login(phone4, password)
     # 2.判断是否登录
     r = self.api.islogin()
     print("登录查询结果:", r.json())
     logger.info("请求数据:{} 执行结果:{}".format((phone4, password, expect_code), r.json()))
     try:
         common_assert(self, r, status=expect_code)
     except Exception as e:
         logger.error(e)
         raise
 def test02_sms_code(self,phone,imgverifycode,type,expect_code,expect_status,description):
     # 1. 获取图片验证码 目的: 使用session对象自动记录cookie
     self.api.reg_img_code(random.random())
     # 2. 获取短信验证码
     r = self.api.reg_sms_code(phone,imgverifycode,type=type)
     print("获取短信验证码 结果为: ", r.json())
     try:
         # 调用断言方法
         common_assert(self, r,status_code=expect_code,status=expect_status, description=description)
     except Exception as e:
         logger.error(e)
         raise
Beispiel #30
0
 def test02_sms_code(self):
     # 1. 获取图片验证码 目的: 使用session对象自动记录cookie
     self.api.reg_img_code(random.random())
     # 2. 获取短信验证码
     r = self.api.reg_sms_code(phone, verifycode)
     print("获取短信验证码 结果为: ", r.json())
     try:
         # 调用断言方法
         common_assert(self, r, description="发送成功")
     except Exception as e:
         logger.error(e)
         raise