def test_065(self): testname = "删除隧道" expect = "删除成功" user_list = RequestAPI().API_get_code( 'tunnel/sytline/page?current=1&size=5&queryParam=', {}, token)['Response_Data']['data']['records'] param = {} data = RequestAPI().API_delete_code( 'tunnel/sytline/del?tunnelId=%s' % user_list[0]['tunnelId'], param, token) data.update({ "testname": testname, 'expect': expect, "project": project }) Out_info().html_out_info(data) self.assertIn(expect, str(data["Response_Data"]))
def test_001(self): testname = "核对裂缝告警数量" expect = "保存成功" param = { "carName": "tets1", "carCode": "tets1", "companyId": 2, "carType": "railway", "currentLocation": "tets1" } data = RequestAPI().API_post_code("vehicle/sytcarinfo/add", param, token) data.update({ "testname": testname, 'expect': expect, "project": project }) Out_info().html_out_info(data) self.assertIn(str(data["expect"]), str(data["Response_Data"]))
def test_083(self): testname = "删除使用单位" expect = "删除成功" user_list = \ RequestAPI().API_get_code('tunnel/sytcompany/queryPage?current=1&size=5&queryParam=%E8%A5%BF%E5%AE%89%E9%93%81%E8%B7%AF%E5%AE%9D%E9%B8%A1%E5%88%86%E5%B1%80_tets001', {}, token)[ 'Response_Data']['data']['records'] param = {} data = RequestAPI().API_delete_code( 'tunnel/sytcompany/del/%s' % user_list[0]['companyId'], param, token) data.update({ "testname": testname, 'expect': expect, "project": project }) Out_info().html_out_info(data) self.assertIn(expect, str(data["Response_Data"]))
def test_053(self): testname = "删除报表" expect = "删除成功" Excle_list = RequestAPI().API_get_code( "report/syt/page?reportCode=¤t=1&size=10", {}, token)['Response_Data']['data']['records'] param = {} data = RequestAPI().API_delete_code( "report/syt/del/%s" % Excle_list[1]["reportId"], param, token) data.update({ "testname": testname, 'expect': expect, "project": project }) Out_info().html_out_info(data) self.assertIn(expect, str(data["Response_Data"]))
def test_052(self): import requests testname = "查看下载Excle" expect = "404 Not Found" data_Excle = RequestAPI().API_get_code( "report/syt/page?reportCode=¤t=1&size=10", {}, token)['Response_Data']['data'] FileUr = RequestAPI().API_get_code("sys/config/findFileUrl", {}, token)['Response_Data']['data'] url_Ex = '%s%s' % (FileUr['httpExcelUrl'], data_Excle['records'][0]['fileUrl']) print('测试项目:%s' % project) print("测试项:%s" % testname) print("下载地址:%s" % url_Ex) response = requests.request("GET", url_Ex, headers={}, data={}) logger.info('《' + project + '项目》' + ',《' + testname + '》项,下载地址:%s' % url_Ex) self.assertNotIn(expect, str(response.text))
def test_080_01(self): testname = "编辑工程阶段" expect = "修改成功" param = {} #获取所有数据列表 data_all_list = RequestAPI().API_get_code( "tunnel/sytstage/queryPage?current=1&size=5&queryParam=", param, token)['Response_Data']["data"] #获取单个信息 data_One_info = RequestAPI().API_get_code( "tunnel/sytstage/get/%s" % data_all_list['records'][0]["stageId"], param, token)["Response_Data"]['data'] #拿到信息编辑更新 data_One_info = { "stageId": data_One_info['stageId'], "stageName": data_One_info['stageName'], "tunnelId": data_One_info['tunnelId'] } data = RequestAPI().API_post_code("tunnel/sytstage/edit", data_One_info, token) data.update({ "testname": testname, 'expect': expect, "project": project }) Out_info().html_out_info(data) self.assertIn(str(data["expect"]), str(data["Response_Data"]))
def test_060(self): testname = "新增人员" expect = "成功" param = { "username": "******", "password": "******", "realname": "hp", "company": "单位单位单位", "phone": "18392040001", "email": "*****@*****.**", "roleId": 1, "tunnelId": 1, "perIds": [1, 2, 3, 4, 5, 6] } data = RequestAPI().API_post_code('sys/user/add', param, token) data.update({ "testname": testname, 'expect': expect, "project": project }) Out_info().html_out_info(data) self.assertIn(expect, str(data["Response_Data"]))
def test_064(self): testname = "新增隧道" expect = "保存成功" param = { "altitudeHight": "2000", "buildTypeStr": "河北地铁", "designSpeed": "2365", "geoTypeStr": "河北地铁", "rainRang": "5000", "temperatureRang": "30", "tunnelLength": "23546", "tunnelName": "河北地铁", "provinceCode": "130000", "cityCode": "130100", "tunnelType": "tunnel_type_1" } data = RequestAPI().API_post_code('tunnel/sytline/add', param, token) data.update({ "testname": testname, 'expect': expect, "project": project }) Out_info().html_out_info(data) self.assertIn(expect, str(data["Response_Data"]))
def test_003(self): testname = "编辑车辆" expect = "修改成功" param = {} data_car_list = RequestAPI().API_get_code( "vehicle/sytcarinfo/page?cityCode=610300¤t=1&provinceCode=610000&size=5", param, token)['Response_Data']["data"] data_carinfo = RequestAPI().API_get_code( "vehicle/sytcarinfo/get/%s" % data_car_list['records'][0]["carId"], param, token)["Response_Data"]['data'] data = RequestAPI().API_put_code("vehicle/sytcarinfo/edit", data_carinfo, token) data.update({ "testname": testname, 'expect': expect, "project": project }) Out_info().html_out_info(data) self.assertIn(str(data["expect"]), str(data["Response_Data"]))
def test_084_01(self): testname = "编辑规则" expect = "修改成功" param = {} #获取所有数据列表 data_all_list = RequestAPI().API_get_code( "tunnel/sytalarmrule/queryPage?queryParam=¤t=1&size=5", param, token)['Response_Data']["data"] #获取单个信息 data_One_info = RequestAPI().API_get_code( "tunnel/sytalarmrule/get/%s" % data_all_list['records'][0]["alarmRuleId"], param, token)["Response_Data"]['data'] #拿到信息编辑更新 data = RequestAPI().API_post_code("tunnel/sytalarmrule/edit", data_One_info, token) data.update({ "testname": testname, 'expect': expect, "project": project }) Out_info().html_out_info(data) self.assertIn(str(data["expect"]), str(data["Response_Data"]))
def test_062(self): testname = "编辑人员" expect = "成功" param = {} data_car_list = RequestAPI().API_get_code( "sys/user/queryPage?current=1&size=5&select=", param, token)['Response_Data']["data"] data_userinfo = RequestAPI().API_get_code( "sys/user/get/%s" % data_car_list['records'][0]["userId"], param, token)["Response_Data"]['data'] # param_info={ # "userId": data_userinfo['userId'], # "username": "******", # "realname": "hjad", # "company": "huadd", # "phone": "18392040045", # "email": "*****@*****.**", # "roleId": 2, # "tunnelId": 1, # "perIds": [1, 2, 3, 4, 5, 6] # } data_userinfo.update( {"tunnelId": data_userinfo['userLine']['tunnelId']}) del data_userinfo['userPers'] del data_userinfo['userLine'] data_userinfo.update({"perIds": [1, 2, 3, 4, 5, 6]}) data = RequestAPI().API_post_code("sys/user/edit", data_userinfo, token) data.update({ "testname": testname, 'expect': expect, "project": project }) Out_info().html_out_info(data) self.assertIn(str(data["expect"]), str(data["Response_Data"]))