def test_PlayerRegist03(self): """验证手机验证码注册:多个在有效期内验证码,输入最新的""" mobile = 19925757099 code1 = OpenPlatformCommon.get_smscode(mobile=mobile) code2 = OpenPlatformCommon.get_smscode(mobile=mobile) datas = { "type": 2, "channelNo": 81026962, "packageNo": 81026962001, "ip": "58.63.60.133", "machineCode": "autotest8888", "appId": "8103xqzESJOPvBzwHikLWwTXHfF6iZzE", "terminalType": 1, "osVersion": "Android.8.3.1", "machineModel": "MI 9", "payload": { "Mobile": mobile, "SmsKey": "1", "SmsCode": code2 }, "networkState": 0, "wifiName": "MISnet" } params = json.dumps(datas) headers = {'Content-Type': "application/json"} res = self.client.send(data=params, headers=headers) res_success = JMESPathExtractor().extract(query='success', body=res.text) res_message = JMESPathExtractor().extract(query='message', body=res.text) res_error = JMESPathExtractor().extract(query='error', body=res.text) res_code = JMESPathExtractor().extract(query='code', body=res.text) responseTime = JMESPathExtractor().extract(query='responseTime', body=res.text) res_data = JMESPathExtractor().extract(query='data', body=res.text) res_openId = JMESPathExtractor().extract(query='data.openId', body=res.text) res_unionId = JMESPathExtractor().extract(query='data.unionId', body=res.text) res_nickname = JMESPathExtractor().extract(query='data.nickname', body=res.text) res_account = JMESPathExtractor().extract(query='data.account', body=res.text) res_password = JMESPathExtractor().extract(query='data.password', body=res.text) res_picture = JMESPathExtractor().extract(query='data.picture', body=res.text) msg = '\n请求地址:' + res.url + '\n请求数据:' + params + '\n返回结果:' + res.text self.assertTrue(res_success, msg=msg) self.assertIsNone(res_error, msg=msg) self.assertEqual(0, res_code, msg=msg) self.assertGreater(len(res_openId), 0, msg=msg) self.assertGreater(len(res_unionId), 0, msg=msg) self.assertIn('游客', res_nickname, msg=msg) self.assertEqual(str(mobile), res_account, msg=msg) self.assertEqual(18, len(res_password), msg=msg)
def test_PlayerLogin03(self): """验证手机验证码登录:多个在有效期内验证码,输入最新的""" mobile = 17712345678 code1 = OpenPlatformCommon.get_smscode(mobile=mobile) code2 = OpenPlatformCommon.get_smscode(mobile=mobile) datas = { "channelNo": 81026962, "packageNo": 81026962001, "type": 1, "ip": "58.63.60.71", "machineCode": "s0qO3Jz9TLeM2CtQ50x", "appId": "8102Fv0aBOMJ5lbt6mMSrqBSPE7cpI8A", "terminalType": 1, "osVersion": "Android.8.3.1", "machineModel": "MI 9", "payload": { "Mobile": mobile, "SmsKey": "1", "SmsCode": code2 }, "networkState": 0, "wifiName": "MISnet" } params = json.dumps(datas) headers = {'Content-Type': "application/json"} res = self.client.send(data=params, headers=headers) res_success = JMESPathExtractor().extract(query='success', body=res.text) res_message = JMESPathExtractor().extract(query='message', body=res.text) res_error = JMESPathExtractor().extract(query='error', body=res.text) res_code = JMESPathExtractor().extract(query='code', body=res.text) responseTime = JMESPathExtractor().extract(query='responseTime', body=res.text) res_data = JMESPathExtractor().extract(query='data', body=res.text) res_openId = JMESPathExtractor().extract(query='data.openId', body=res.text) res_nickname = JMESPathExtractor().extract(query='data.nickname', body=res.text) res_account = JMESPathExtractor().extract(query='data.account', body=res.text) res_mobile = JMESPathExtractor().extract(query='data.mobile', body=res.text) res_picture = JMESPathExtractor().extract(query='data.picture', body=res.text) msg = '\n请求地址:' + res.url + '\n请求数据:' + params + '\n返回结果:' + res.text self.assertTrue(res_success, msg=msg) self.assertIsNone(res_error, msg=msg) self.assertEqual(0, res_code, msg=msg) self.assertEqual('jpSeis_Pz8_Pz8_Hzs_NxsrHyMiHu76v', res_openId, msg=msg) self.assertEqual('游客23113470', res_nickname, msg=msg) self.assertEqual(str(mobile), res_account, msg=msg) self.assertEqual(str(mobile), res_mobile, msg=msg)
def test_PlayerLogin05(self): """验证手机验证码注册:有效期内多次请求验证码,输入的不是最新的""" mobile = 17712345678 code1 = OpenPlatformCommon.get_smscode(mobile=mobile) code2 = OpenPlatformCommon.get_smscode(mobile=mobile) datas = { "channelNo": 81026962, "packageNo": 81026962001, "type": 1, "ip": "58.63.60.71", "machineCode": "s0qO3Jz9TLeM2CtQ50x", "appId": "8102Fv0aBOMJ5lbt6mMSrqBSPE7cpI8A", "terminalType": 1, "osVersion": "Android.8.3.1", "machineModel": "MI 9", "payload": { "Mobile": mobile, "SmsKey": "1", "SmsCode": code1 }, "networkState": 0, "wifiName": "MISnet" } params = json.dumps(datas) headers = {'Content-Type': "application/json"} res = self.client.send(data=params, headers=headers) res_success = JMESPathExtractor().extract(query='success', body=res.text) res_message = JMESPathExtractor().extract(query='message', body=res.text) res_error = JMESPathExtractor().extract(query='error', body=res.text) res_code = JMESPathExtractor().extract(query='code', body=res.text) responseTime = JMESPathExtractor().extract(query='responseTime', body=res.text) res_data = JMESPathExtractor().extract(query='data', body=res.text) msg = '\n请求地址:' + res.url + '\n请求数据:' + params + '\n返回结果:' + res.text self.assertFalse(res_success, msg=msg) self.assertEqual('验证码错误', res_error, msg=msg) self.assertEqual(10, res_code, msg=msg) self.assertIsNone(res_data, msg=msg)
def test_PlayerPromote05(self): """验证手机验证码转正:有效期内多次请求验证码,输入的不是最新的""" if OpenPlatformCommon.get_registinfo() != '注册失败': openId = OpenPlatformCommon.get_registinfo()['openId'] unionId = OpenPlatformCommon.get_registinfo()['unionId'] nickname = OpenPlatformCommon.get_registinfo()['nickname'] account = OpenPlatformCommon.get_registinfo()['account'] password = OpenPlatformCommon.get_registinfo()['password'] mobile = 19925757299 code1 = OpenPlatformCommon.get_smscode(mobile=mobile) code2 = OpenPlatformCommon.get_smscode(mobile=mobile) datas = { "openId": openId, "packageNo": 81036962002, "type": 1, "payload": { "mobile": mobile, "smsKey": "1", "smsCode": code1, "password": "******" } } params = json.dumps(datas) headers = {'Content-Type': "application/json"} res = self.client.send(data=params, headers=headers) res_success = JMESPathExtractor().extract(query='success', body=res.text) res_message = JMESPathExtractor().extract(query='message', body=res.text) res_error = JMESPathExtractor().extract(query='error', body=res.text) res_code = JMESPathExtractor().extract(query='code', body=res.text) responseTime = JMESPathExtractor().extract(query='responseTime', body=res.text) msg = '\n请求地址:' + res.url + '\n请求数据:' + params + '\n返回结果:' + res.text self.assertFalse(res_success, msg=msg) self.assertEqual('验证短信失败', res_error, msg=msg) self.assertEqual(10, res_code, msg=msg)