def test06_approve_query(self): reponse = self.logAPI.loginenroll(self.session, self.phone, self.password) assertEqual_utils(self, reponse, 200, 200, '登录成功') reponse = self.approveApi.approvequery(self.session) self.assertEqual(200, reponse.status_code) self.assertEqual('-1', reponse.json().get('is_email_open'))
def test19_get_enroll_statu(self): reponse = self.loginAPI.loginenroll(self.session, self.phone, self.password) assertEqual_utils(self, reponse, 200, 200, '登录成功') reponse = self.loginAPI.loginstatu(self.session) self.assertEqual(200, reponse.status_code) self.assertEqual('OK', reponse.json().get('description'))
def test05_approve_id_format_wrong(self): reponse = self.logAPI.loginenroll(self.session, self.phone1, self.password) assertEqual_utils(self, reponse, 200, 200, '登录成功') reponse = self.approveApi.approve(self.session, '向玉宇', '410801') logging.info('log={}'.format(reponse.json())) assertEqual_utils(self, reponse, 200, 100, '身份证号格式不正确')
def test03_approve_id_null(self): reponse = self.logAPI.loginenroll(self.session, self.phone1, self.password) assertEqual_utils(self, reponse, 200, 200, '登录成功') reponse = self.approveApi.approve(self.session, '喀喀喀', '') logging.info('log={}'.format(reponse.json())) assertEqual_utils(self, reponse, 200, 100, '身份证号不能为空')
def test02_approve_name_null(self): reponse = self.logAPI.loginenroll(self.session, self.phone1, self.password) assertEqual_utils(self, reponse, 200, 200, '登录成功') reponse = self.approveApi.approve(self.session, '', '130683199011300601') logging.info('log={}'.format(reponse.json())) assertEqual_utils(self, reponse, 200, 100, '姓名不能为空')
def test04_approve_id_exists(self): reponse = self.logAPI.loginenroll(self.session, self.phone1, self.password) assertEqual_utils(self, reponse, 200, 200, '登录成功') reponse = self.approveApi.approve(self.session, '向玉宇', '41080119930228457X') logging.info('log={}'.format(reponse.json())) assertEqual_utils(self, reponse, 200, 100, '身份证号已存在')
def test05_get_sms_code_scuess(self): #成功获取图片验证码 r = random.random() reponse = self.loginAPI.loginimgcode_url(self.session, str(r)) self.assertEqual(200, reponse.status_code) #发送短信验证码成功 reponse = self.loginAPI.loginsmscode_url(self.session, self.phone, self.imgVerifyCode) assertEqual_utils(self, reponse, 200, 200, '短信发送成功')
def test01_approve(self): reponse = self.logAPI.loginenroll(self.session, self.phone, self.password) assertEqual_utils(self, reponse, 200, 200, '登录成功') reponse = self.approveApi.approve(self.session, '向玉宇', '41080119930228457X') logging.info('log={}'.format(reponse.json())) self.assertEqual(200, reponse.status_code) self.assertEqual(200, reponse.json().get('status')) #self.aeerstEqual({"card_id":"110****21X","realname":"李**"},reponse.josn().get('data')) self.assertEqual('提交成功!', reponse.json().get('description'))
def test06_get_sms_code_fail(self): #图片验证码错误 r = random.sample('jfefejbfjebfjekeorl', 8) ran = ''.join(r) reponse = self.loginAPI.loginimgcode_url(self.session, ran) self.assertEqual(400, reponse.status_code) # 发送短信验证码失败 imimgVerifyCode_error = '1234' reponse = self.loginAPI.loginsmscode_url(self.session, self.phone, imimgVerifyCode_error) assertEqual_utils(self, reponse, 200, 100, '图片验证码错误')
def test12_get_register_fail(self): # 成功获取图片验证码 r = random.random() reponse = self.loginAPI.loginimgcode_url(self.session, str(r)) self.assertEqual(200, reponse.status_code) # 获取短信验证码 reponse = self.loginAPI.loginsmscode_url(self.session, self.phone, self.imgVerifyCode) assertEqual_utils(self, reponse, 200, 200, '短信发送成功') # 注册失败(手机号码已注册) reponse = self.loginAPI.loginregister(self.session, self.phone, self.password) assertEqual_utils(self, reponse, 200, 100, '手机已存在!')
def test10_get_register_fail(self): #成功获取图片验证码 r = random.random() reponse = self.loginAPI.loginimgcode_url(self.session, str(r)) self.assertEqual(200, reponse.status_code) #获取短信验证码失败(图片验证码错误) reponse = self.loginAPI.loginsmscode_url(self.session, self.phone2, imgVerifyCode='8889') assertEqual_utils(self, reponse, 200, 100, '图片验证码错误') #注册失败 reponse = self.loginAPI.loginregister(self.session, self.phone2, self.password) assertEqual_utils(self, reponse, 200, 100, '验证码过期或无效,请重新获取')
def test09_get_register_success(self): # 成功获取图片验证码 r = random.random() reponse = self.loginAPI.loginimgcode_url(self.session, str(r)) self.assertEqual(200, reponse.status_code) # 发送短信验证码成功 reponse = self.loginAPI.loginsmscode_url(self.session, self.phone1, self.imgVerifyCode) assertEqual_utils(self, reponse, 200, 200, '短信发送成功') reponse = self.loginAPI.loginregister(self.session, self.phone1, self.password, invite_phone='13798987198') #logging.info('the register reponse is {}'.format(reponse.json())) assertEqual_utils(self, reponse, 200, 200, '注册成功')
def test11_get_register_fail(self): #成功获取图片验证码 r = random.random() reponse = self.loginAPI.loginimgcode_url(self.session, str(r)) self.assertEqual(200, reponse.status_code) # 获取短信验证码 reponse = self.loginAPI.loginsmscode_url(self.session, self.phone2, self.imgVerifyCode) assertEqual_utils(self, reponse, 200, 200, '短信发送成功') #注册失败(短信验证码错误) reponse = self.loginAPI.loginregister(self.session, self.phone2, self.password, phone_code='12345') assertEqual_utils(self, reponse, 200, 100, '验证码错误')
def test02_get_register(self, phone, password, verifycode, phone_code, dy_server, invite_phone, status_code, status, description): # 成功获取图片验证码 r = random.random() reponse = self.loginAPI.loginimgcode_url(self.session, str(r)) self.assertEqual(200, reponse.status_code) # 发送短信验证码成功 reponse = self.loginAPI.loginsmscode_url(self.session, phone, self.imgVerifyCode) assertEqual_utils(self, reponse, 200, 200, '短信发送成功') reponse = self.loginAPI.loginregister(self.session, phone, password, verifycode, phone_code, dy_server, invite_phone) print('register reponse={}'.format(reponse.json())) assertEqual_utils(self, reponse, status_code, status, description)
def test08_get_sms_code_fail(self): # 不获取图片验证码 # 发送短信验证码成功 reponse = self.loginAPI.loginsmscode_url(self.session, self.phone, '') assertEqual_utils(self, reponse, 200, 100, '图片验证码错误')
def test07_approve_query(self): reponse = self.logAPI.loginenroll(self.session, self.phone1, self.password) assertEqual_utils(self, reponse, 200, 200, '登录成功') reponse = self.approveApi.approvequery(self.session) self.assertEqual(200, reponse.status_code)
def test17_get_enroll_success(self): reponse = self.loginAPI.loginenroll(self.session, self.phone, self.password) assertEqual_utils(self, reponse, 200, 200, '登录成功')
def test15_get_enroll_fail(self): reponse = self.loginAPI.loginenroll(self.session, self.phone, '') assertEqual_utils(self, reponse, 200, 100, '密码不能为空')
def test14_get_enroll_fail(self): reponse = self.loginAPI.loginenroll(self.session, self.phone2, self.password) assertEqual_utils(self, reponse, 200, 100, '用户不存在')