Beispiel #1
0
    def test2_promote_share(self):
        '''
        分享活动
        :return:
        '''
        contents = {"area_code": "330100", "phone": "18657738817"}
        data = {
            "app_id": 'b1044830052f359d',
            "timestamp": '2019-9-25 2:35:56',
            "version": '1.0',
            "client": 'android',
            "client_version": '4.0.2',
            "device_id": '123123',
            "method": 'promote.share',
            "access_token": '{}'.format(self.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)
Beispiel #2
0
 def setUpClass(self):
     global token
     contents = {
         "phone": "18657738817",
         "password": "******"
     }
     data = {
         "app_id": 'b1044830052f359d',
         "timestamp": '2019-12-3 17:24:2',
         "version": '1.0',
         "client": 'ios',
         "client_version": '4.0.1',
         "device_id": 'iPhone8cb2aa6fb3296abb',
         "method": 'user.login_by_password',
         "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.token = res['data']['token']
     self.user_id = res['data']['user_id']
     return self.token, self.user_id
 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)
Beispiel #4
0
    def test2_query_station_list_10(self):
        '''
        查询站点列表信息:查询分页-第一页
        :return:
        '''
        contents = {"page": "1", "length": "10", "station_name": "站点1"}
        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": 'station.query_station_list',
            "access_token": '{}'.format(self.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)
Beispiel #5
0
 def setUpClass(self):
     global token
     contents = {
         "phone": "18657738815",
         "password": "******"
     }
     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.login_by_password',
         "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()
     print(res)
     self.token = res['data']['token']
     self.user_id = res['data']['user_id']
     return self.token, self.user_id
Beispiel #6
0
    def test8_query_user_by_user_id(self):
        '''
        根据userId查询_无登录Token
        :return:
        '''
        contents = {"userId": "15d6aa852800318"}
        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.logout',
            "access_token": '{}'.format(None),
            "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'] == 1000, msg="校验code错误")
        miaoshu(url=self.app_host,
                method='post',
                data=datas,
                check={"code and message"},
                respons=res)
Beispiel #7
0
    def test1_create_vehicle_notoken(self):
        '''
        新增/修改车辆信息:无token
        :return:
        '''
        contents = {
            "user_id": "{}".format(self.user_id),
            "vehicle_number": "浙AJ1800",
            "vehicle_model": "法拉利"
        }
        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": 'vehicle.create_vehicle',
            "access_token": '{}'.format(None),
            "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'] == 100001, msg="校验code错误")
        miaoshu(url=self.app_host,
                method='post',
                data=datas,
                check={"code and message"},
                respons=res)
    def test_15_modifyPwdByOld_right(self):
        '''
        修改密码:通过密码来重置密码_原密码错误
        :return:
        '''
        contents = {
            "user_id": "{}".format(user_id),
            "old_password": "******",
            "new_password": "******"
        }
        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_password',
            "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)
    def test2_register_errorMsgCode(self):
        '''
        注册:注册用户_错误验证码
        :return:
        '''
        contents = {
            "phone": "{}".format(self.phone),
            "verification_code": "000000",
            "area_code": "3301"
        }
        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'] == 110001, msg="校验code错误")
        miaoshu(url=self.app_host,
                method='post',
                data=datas,
                check={"code and message"},
                respons=res)
    def test_17_modifyPhone_sendMsg_NoRegister(self):
        """
        修改手机号:发送验证码_修改后手机号未注册
        :return:
        """

        contents = {"phone": "{}".format(self.new_phone), "type": 5}
        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.send_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)
Beispiel #11
0
    def test2_login_byPwd_EorPwd(self):
        '''
        登录-用户存在,密码错误
        :return:
        '''
        contents = {"phone": "18657738815", "password": "******"}
        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.login_by_password',
            "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'] == 110005, msg="校验code错误")
        miaoshu(url=self.app_host,
                method='post',
                data=datas,
                check={"code and message"},
                respons=res)
 def test_11_modifyPwdCheckCode_error(self):
     '''
     修改密码:校验验证码(验证码错误)
     :return:
     '''
     contents = {
         "phone": "{}".format(self.phone),
         "type": 3,
         "verification_code": "000000"
     }
     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',
         "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'] == 110001, msg="校验code错误")
     miaoshu(url=self.app_host,
             method='post',
             data=datas,
             check={"code and message"},
             respons=res)
 def test5_SendMsg_right(self):
     """
     注册:发送验证码_用户已注册
     :return:
     """
     contents = {"phone": "15715814052", "type": 2}
     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.send_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'] == 110002, msg="校验code错误")
     miaoshu(url=self.app_host,
             method='post',
             data=datas,
             check={"code and message"},
             respons=res)
    def test4_register_setPwd(self):
        '''
        注册:设置密码注册
        :return:
        '''

        contents = {"user_id": "{}".format(user_id), "password": "******"}
        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.update_user',
            "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)
 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
Beispiel #16
0
    def test1_user_coupon_count(self):
        '''
        查询优惠券数量
        :return:
        '''

        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": 'coupon.user_coupon_count',
                "access_token": '{}'.format(self.token),
                }
        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)
Beispiel #17
0
    def test2_create_vehicle_number_exist(self):
        '''
        新增/修改车辆信息:有token_车牌号不存在
        :return:
        '''
        sql = "DELETE from `ifuel-vehicle`.t_vehicle WHERE `user_id`='15d6aa852800318';"
        mysql_execute(sql, number='one')
        contents = {
            "user_id": "{}".format(self.user_id),
            "vehicle_number": "浙AJ1800",
            "vehicle_model": "法拉利"
        }
        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": 'vehicle.create_vehicle',
            "access_token": '{}'.format(self.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)
 def test_18_modifyPhone_newphone(self):
     '''
     修改手机号:修改用户登录手机号
     :return:
     '''
     MsgCode = get_cluster_value("modify_phone_{}".format(self.new_phone),
                                 nodes=self.nodes)
     print(MsgCode)
     contents = {
         "new_phone": "{}".format(self.new_phone),
         "user_id": "{}".format(user_id),
         "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.modify_phone',
         "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)
Beispiel #19
0
    # lujing='/customer/v1/member/login'
    # datas={"phone":"18657738815","password":"******"}
    #
    # headers={"Content-Type":"application/json; charset=utf-8"}

    host = 'http://124.160.35.34:8091/service.do/'

    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.sendVerificationCode',
        "biz_content": '{"phone":"13185097298","type":1}',
    }
    headers = {
        "Content-Type": "application/x-www-form-urlencoded",
        "Connection": "keep-alive"
    }
    SigSecret = '204414295c2f3fbc5818f604793f1ba2'
    datas = dict(sorted(data.items(), key=lambda x: x[0], reverse=False))
    sign = new_hmac_md5(SigSecret, datas)
    datas.update({"sign": sign})
    print(datas)
    res = requests.post(url=host, data=datas, headers=headers).json()
    # res=run.run_main('post',host,datas,headers)
    print(res)
    # print(type(res))