def test_lease_community_addonefloor(self): """ test body :return: """ # 给get或者post方法配置Http地址 self.localConfigHttp = configHttp_new.ConfigHttp() # 接口地址存储在excel文件里,读取出来 self.localConfigHttp.set_url(self.service_id) # set params data = json.loads(self.data) # 判断是否需要token if self.token == 1: f = open(token_fiel_path, 'r') token_tmp = f.readline() data['access_token'] = token_tmp print '获取到的最新token:', data['access_token'] # 判断是否需要获取验证码 if 'sms_code' in data: sql = localReadConfig.get_sql('sql_yzm') yzm = configDB.MyDB().zhiyu_yzm(sql) data['sms_code'] = yzm # 获取house_id,如果excel表格里house_id为空,则取ini文件里的house_id,否则取excel里的house_id if 'house_id' in data: if data['house_id'] == '': house_id = localReadConfig.get_ini('PARAMS', 'house_id') data['house_id'] = house_id # 获取时间戳 time_now = common.get_time_now() data['timestamp'] = time_now # 查找楼栋 sql = "SELECT * FROM lp_building WHERE community_id = '12873' ORDER BY id DESC;" building_id = configDB.MyDB().zhiyu_getone(sql) data['building_id'] = building_id sql1 = "SELECT * FROM lp_unit WHERE community_id = '12873' ORDER BY id DESC;" unit_id = configDB.MyDB().zhiyu_getone(sql1) data['unit_id'] = unit_id # AES加密 params_miwen = encryptLib.zhiyu_aes_encode(data) # 真正的入参 params = {'param': params_miwen} self.localConfigHttp.set_params(params) # 获取响应结果信息 if self.method.lower() == 'get': self.response = self.localConfigHttp.get() print 'get' elif self.method.lower() == 'post': self.response = self.localConfigHttp.post() print 'post' # 显示响应结果信息 common.show_return_msg(self.response) self.info = self.response.text # Json响应信息转成字典格式 self.info = json.loads(self.info) # 断言返回状态码 self.assertEqual(self.info['err_no'], self.expect_state) # 断言返回message mes_reponse = self.info['err_msg'].encode('utf-8') self.assertEqual(mes_reponse, self.expect_msg)
def test_guanjia_repair_info(self): """ test body :return: """ # 给get或者post方法配置Http地址 self.localConfigHttp = configHttp_new.ConfigHttp(env_old_new='old') # 接口地址存储在excel文件里,读取出来 self.localConfigHttp.set_url(self.service_id) # set params data = json.loads(self.data) # 判断是否需要token if self.token == 1: f = open(token_fiel_path, 'r') token_tmp = f.readline() data['access_token'] = token_tmp print '获取到的最新token:', data['access_token'] # 判断是否需要获取验证码 if 'sms_code' in data: sql = localReadConfig.get_sql('sql_yzm') yzm = configDB.MyDB().zhiyu_yzm(sql) data['sms_code'] = yzm # 获取house_id,如果excel表格里house_id为空,则取ini文件里的house_id,否则取excel里的house_id if 'house_id' in data: if data['house_id'] == '': house_id = localReadConfig.get_ini('PARAMS', 'house_id') data['house_id'] = house_id # # 获取时间戳 # time_now = common.get_time_now() # data['timestamp'] = time_now # AES加密 params_miwen = encryptLib.zhiyu_des_encode(data) # 真正的入参 params = { 'client_id': '1fobqa5ofzixluyjlum7icdufabjfo25', 'param': params_miwen } self.localConfigHttp.set_params(params) # 获取响应结果信息 if self.method.lower() == 'get': self.response = self.localConfigHttp.get() print 'get' elif self.method.lower() == 'post': self.response = self.localConfigHttp.post() print 'post' # 显示响应结果信息 common.show_return_msg(self.response) self.info = self.response.text # Json响应信息转成字典格式 self.info = json.loads(self.info) # 存储token,只有正确登录的时候才有token if 'access_token' in self.info['data']: token_temp = self.info['data']['access_token'] localReadConfig.set_headers('token_temp', token_temp) # 断言返回状态码 self.assertEqual(self.info['err_no'], self.expect_state) # 断言返回message mes_reponse = self.info['err_msg'].encode('utf-8') self.assertEqual(mes_reponse, self.expect_msg)
def test_rent_conf_order_index(self): """ test body :return: """ # 给get或者post方法配置Http地址 self.localConfigHttp = configHttp_new.ConfigHttp() # 接口地址存储在excel文件里,读取出来 self.localConfigHttp.set_url(self.service_id) # set params data = json.loads(self.data) # 判断是否需要token if self.token == 1: f = open(token_fiel_path, 'r') token_tmp = f.readline() data['access_token'] = token_tmp print '获取到的最新token:', data['access_token'] # 判断是否需要获取验证码 if 'sms_code' in data: sql = localReadConfig.get_sql('sql_yzm') yzm = configDB.MyDB().zhiyu_yzm(sql) data['sms_code'] = yzm # 获取house_id,如果excel表格里house_id为空,则取ini文件里的house_id,否则取excel里的house_id if 'house_id' in data: if data['house_id'] == '': house_id = localReadConfig.get_ini('PARAMS', 'house_id') data['house_id'] = house_id # 获取时间戳 time_now = common.get_time_now() data['timestamp'] = time_now # AES加密 params_miwen = encryptLib.zhiyu_aes_encode(data) # 真正的入参 params = {'param': params_miwen} self.localConfigHttp.set_params(params) # 获取响应结果信息 if self.method.lower() == 'get': self.response = self.localConfigHttp.get() print 'get' elif self.method.lower() == 'post': self.response = self.localConfigHttp.post() print 'post' # 显示响应结果信息 common.show_return_msg(self.response) self.info = self.response.text # Json响应信息转成字典格式 self.info = json.loads(self.info) # 断言返回状态码 self.assertEqual(self.info['err_no'], self.expect_state) # 断言返回message mes_reponse = self.info['err_msg'].encode('utf-8') self.assertEqual(mes_reponse, self.expect_msg) # 断言返回具体内容 if self.expect_result != '': data_reponse = self.info['data'] name_reponse = data_reponse[0]['real_name'] mobile_reponse = data_reponse[0]['mobile'] self.expect_result = json.loads(self.expect_result) name = self.expect_result['real_name'] mobile = self.expect_result['mobile'] self.assertEqual(name_reponse, name) self.assertEqual(mobile_reponse, mobile)
def test_wallet_bind(self): """ test body :return: """ # 给get或者post方法配置Http地址 self.localConfigHttp = configHttp_new.ConfigHttp(env_old_new='v1.5') # 接口地址存储在excel文件里,读取出来 self.localConfigHttp.set_url(self.service_id) # set params data = json.loads(self.data) # 判断是否需要token if self.token == 1: f = open(token_fiel_path, 'r') token_tmp = f.readline() data['access_token'] = token_tmp print '获取到的最新token:', data['access_token'] # 判断是否需要获取验证码 if 'sms_code' in data: sql = localReadConfig.get_sql('sql_yzm') yzm = configDB.MyDB().zhiyu_yzm(sql) data['sms_code'] = yzm # 获取house_id,如果excel表格里house_id为空,则取ini文件里的house_id,否则取excel里的house_id if 'house_id' in data: if data['house_id'] == '': house_id = localReadConfig.get_ini('PARAMS', 'house_id') data['house_id'] = house_id # # 获取时间戳 # time_now = common.get_time_now() # data['timestamp'] = time_now # AES加密 params_miwen = encryptLib.zhiyu_aes_encode_v1_5(data) # 真正的入参 params = { 'encrypt': 'APPAES', 'client_id': '586ee968a305374e6198f6b7c293b07a', 'param': params_miwen } self.localConfigHttp.set_params(params) # 获取响应结果信息 if self.method.lower() == 'get': self.response = self.localConfigHttp.get() print 'get' elif self.method.lower() == 'post': self.response = self.localConfigHttp.post() print 'post' # 显示响应结果信息 common.show_return_msg(self.response) self.info = self.response.text # Json响应信息转成字典格式 self.info = json.loads(self.info) # 存储token,只有正确登录的时候才存储token if 'access_token' in self.info['data'] and self.info[ 'err_msg'] == 'success': token_temp = self.info['data']['access_token'] # localReadConfig.set_headers('token_temp', token_temp) f = open(token_fiel_path, 'w') f.write(token_temp) print '最新token存储完成...', token_temp # 存储trac_no邦卡跟踪单号 if 'trac_no' in self.info['data'] and self.info['err_msg'] == 'success': trac_no = self.info['data']['trac_no'] f = open(trac_no_path, 'w') f.write(trac_no) # 断言返回状态码 self.assertEqual(self.info['err_no'], self.expect_state) # 断言返回message mes_reponse = self.info['err_msg'].encode('utf-8') self.assertEqual(mes_reponse, self.expect_msg)