def test8_ForgetCheckMsgCode_right(self): ''' 忘记密码:校验验证码(验证码正确) :return: ''' MsgCode = get_cluster_value("forget_password_{}".format(self.phone), nodes=self.nodes) print(MsgCode) contents = { "phone": "{}".format(self.phone), "type": 3, "verification_code": "{}".format(MsgCode) } data = { "app_id": 'b1044830052f359d', "timestamp": '2019-9-25 2:35:56', "version": '1.0', "client": 'android', "client_version": '4.0.1', "device_id": '123123', "method": 'user.check_verification_code', "biz_content": '{}'.format(contents), } datas = dict(sorted(data.items(), key=lambda x: x[0], reverse=False)) sign = new_hmac_md5(self.SigSecret, datas) datas.update({"sign": sign}) res = requests.post(url=self.app_host, data=datas, headers=self.headers).json() self.assertTrue(res['code'] == 0, msg="校验code错误") miaoshu(url=self.app_host, method='post', data=datas, check={"code and message"}, respons=res)
def test3_register_right(self): ''' 注册:注册用户_正确验证码 :return: ''' global token, user_id MsgCode = get_cluster_value("register_{}".format(self.phone), nodes=self.nodes) print(MsgCode) contents = { "phone": "{}".format(self.phone), "verification_code": "{}".format(MsgCode) } data = { "app_id": 'b1044830052f359d', "timestamp": '2019-9-25 2:35:56', "version": '1.0', "client": 'android', "client_version": '4.0.1', "device_id": '123123', "method": 'user.register', "biz_content": '{}'.format(contents), } datas = dict(sorted(data.items(), key=lambda x: x[0], reverse=False)) sign = new_hmac_md5(self.SigSecret, datas) datas.update({"sign": sign}) res = requests.post(url=self.app_host, data=datas, headers=self.headers).json() self.assertTrue(res['code'] == 0, msg="校验code错误") miaoshu(url=self.app_host, method='post', data=datas, check={"code and message"}, respons=res) # print(res['data']['token']) token = res['data']['token'] user_id = res['data']['user_id'] return token, user_id
def test_13_modifyPwdByPhone(self): ''' 修改密码:通过验证码来重置密码 :return: ''' MsgCode = get_cluster_value("forget_password_{}".format(self.phone), nodes=self.nodes) print(MsgCode) contents = { "phone": "{}".format(self.phone), "new_password": "******", "verification_code": "{}".format(MsgCode) } data = { "app_id": 'b1044830052f359d', "timestamp": '2019-9-25 2:35:56', "version": '1.0', "client": 'android', "client_version": '4.0.1', "device_id": '123123', "method": 'user.reset_password_by_verification_code', "access_token": '{}'.format(token), "biz_content": '{}'.format(contents), } datas = dict(sorted(data.items(), key=lambda x: x[0], reverse=False)) sign = new_hmac_md5(self.SigSecret, datas) datas.update({"sign": sign}) res = requests.post(url=self.app_host, data=datas, headers=self.headers).json() self.assertTrue(res['code'] == 0, msg="校验code错误") miaoshu(url=self.app_host, method='post', data=datas, check={"code and message"}, respons=res)