def test_001_warn(self): # 处理报警信息页面初始化数据 finance_id = fs.get_car_id(c.car_owner) warnid = fs.get_warn_id(warn_type='sh', financeid=finance_id) r = json.loads(f.test_warn_getHandleWarnMessage(warnid)) a.verity(r['data']['warnid'], warnid, '断言warnid') # 获取设备报警记录 f.test_warn_getWarns('', 1, 10, 0) riskid = fs.get_risk_id(c.riskName) # 根据ID获取风险点详情 r1 = json.loads(f.test_warn_getRiskDetail(riskid)) a.verity(r1['data']['id'], riskid, '断言riskid') # 根据报警记录ID获取报警记录详情 f.test_warn_getWarnDetailById() f.test_warn_doHandleWarn(1, '', '', 1, warnid)
def test_006_risk_getDetail(self): self.risk_id = fs.get_risk_id(c.riskName) # 获取风险点详细信息 r6 = json.loads(f.test_risk_getDetail(self.risk_id)) a.verity(r6['data']['name'], c.riskName, '断言name') a.verity(r6['data']['orgCode'], orgCode, '断言orgCode') a.verity(r6['data']['riskType'], "PLEDEGREPEAT", '断言riskType') a.verity(r6['data']['gisType'], "CIRCLE", '断言gisType') a.verity(r6['data']['id'], self.risk_id, '断言id') a.verity(r6['data']['rules'][0]['id'], fs.get_rule_id('OUT', self.risk_id), '断言rules-id') a.verity(r6['data']['rules'][0]['ruleType'], "OUT", '断言ruleType') a.verity(r6['data']['rules'][0]['ruleName'], "出围栏报警", '断言ruleName') a.verity(r6['data']['rules'][1]['id'], fs.get_rule_id('STAY', self.risk_id), '断言rules-id') a.verity(r6['data']['rules'][1]['ruleType'], "STAY", '断言ruleType') a.verity(r6['data']['rules'][1]['thresholdMax'], c.risk_thresholdMax, '断言thresholdMax') a.verity(r6['data']['rules'][1]['ruleName'], "停留报警", '断言ruleName') a.verity(r6['data']['rules'][2]['id'], fs.get_rule_id('IN', self.risk_id), '断言rules-id') a.verity(r6['data']['rules'][2]['ruleType'], "IN", '断言ruleType') a.verity(r6['data']['rules'][2]['ruleName'], "入围栏报警", '断言ruleName')
def test_017_historyTrack(self): # 根据gpscode查询用户的车贷数据 r = json.loads(f.test_historyTrack_getFinanceByGpsCode(c.deviceCode)) gpsid = fs.get_device_id(c.deviceCode) financeid = fs.get_carid_by_gpsid(gpsid) carNo = fs.get_car_info_by_financeid(financeid, 'car_no') owner = fs.get_car_info_by_financeid(financeid) ownerMoble = fs.get_car_info_by_financeid(financeid, 'owner_moble') a.verity(r['data']['id'], financeid) a.verity(r['data']['orgCode'], orgCode) a.verity(r['data']['carNo'], carNo) a.verity(r['data']['owner'], owner) a.verity(r['data']['ownerMoble'], ownerMoble) # 根据financeId查询用户的车贷数据 r1 = json.loads(f.test_historyTrack_getFinanceById(financeid)) a.verity(r1['data']['id'], financeid) a.verity(r1['data']['orgCode'], orgCode) a.verity(r1['data']['carNo'], carNo) a.verity(r1['data']['owner'], owner) a.verity(r1['data']['ownerMoble'], ownerMoble) # 根据financeId查询绑定的GPS信息 f.test_historyTrack_getGpsByFinanceId(financeid) # 获取历史轨迹定位信息(单条记录,返回所有字段) f.test_historyTrack_getHistoryLocation('5b188ff706699000015cda1e') # 获取历史轨迹(多条记录,分页查询) f.test_historyTrack_getHistoryLocationByPage( '', '', '', 1, 10, 1, c.deviceCode, c.station_starttime, c.station_endtime, 0) # 获取历史轨迹定位信息(全部,只返回定位相关) f.test_historyTrack_getHistoryTrack( c.deviceCode, 0, 1, c.station_starttime, c.station_endtime) riskid = fs.get_risk_id(c.riskName) # 根据id查询风险点详情 f.test_historyTrack_getRiskDtoById(riskid) # 通过车贷id查询相关的所有风险点 f.test_historyTrack_getRisksByOrgCode(c.deviceCode) # 根据gpsId查询相关的停车数据,查询所有 f.test_historyTrack_getStationByGpsId(financeid, gpsid, c.station_starttime, c.station_endtime, 0) # 根据报警记录ID获取报警记录详情 warnid = fs.get_warn_id(financeid=financeid) f.test_historyTrack_getWarnDetailById(warnid) # 根据报警记录ID获取报警记录详情 f.test_historyTrack_getWarnsByGpsId(gpsid, c.station_starttime, c.station_endtime)
def test_004_risk_save(self): # 新增风险点 r4 = json.loads(f.test_risk_save( str({'address': '', 'coords': '104.077945,30.66153,100', 'gisType': 'CIRCLE', 'id': '', 'name': c.riskName, 'radius': '100', 'orgCode': orgCode, 'riskType': 'PLEDEGREPEAT', 'rules': [{'id': '', 'riskId': '', 'ruleType': 'OUT'}, {'id': '', 'riskId': '', 'ruleType': 'STAY', 'thresholdMax': c.risk_thresholdMax}, {'id': '', 'riskId': '', 'ruleType': 'IN'}], 'otherRemark': ''}))) self.risk_id = fs.get_risk_id(c.riskName) a.verity(r4['data']['name'], c.riskName, '断言name') a.verity(r4['data']['orgCode'], orgCode, '断言orgCode') a.verity(r4['data']['riskType'], "PLEDEGREPEAT", '断言riskType') a.verity(r4['data']['gisType'], "CIRCLE", '断言gisType') a.verity(r4['data']['id'], self.risk_id, '断言id') a.verity(r4['data']['rules'][0]['id'], fs.get_rule_id('OUT', self.risk_id), '断言rules-id') a.verity(r4['data']['rules'][0]['ruleType'], "OUT", '断言ruleType') a.verity(r4['data']['rules'][1]['id'], fs.get_rule_id('STAY', self.risk_id), '断言rules-id') a.verity(r4['data']['rules'][1]['ruleType'], "STAY", '断言ruleType') a.verity(r4['data']['rules'][1]['thresholdMax'], c.risk_thresholdMax, '断言thresholdMax') a.verity(r4['data']['rules'][2]['id'], fs.get_rule_id('IN', self.risk_id), '断言rules-id') a.verity(r4['data']['rules'][2]['ruleType'], "IN", '断言ruleType')
def test_007_risk_delete(self): self.risk_id = fs.get_risk_id(c.riskName) # 删除一个风险点 f.test_risk_delete(self.risk_id, orgCode)
def test_004_risk(self): # 获取组织机构 r1 = json.loads(f.test_risk_getOrgs()) a.verity(r1['data'][0]['name'], c.companyName, '断言org-name') a.verity(r1['data'][0]['orgCode'], orgCode, '断言org-name') # 获取报警规则 r2 = json.loads(f.test_risk_getRules()) a.verity(r2['data'][0]['name'], "出区域报警", '断言name') a.verity(r2['data'][0]['value'], "OUT", '断言value') a.verity(r2['data'][1]['name'], "入区域报警", '断言name') a.verity(r2['data'][1]['value'], "IN", '断言value') a.verity(r2['data'][2]['name'], "停留报警", '断言name') a.verity(r2['data'][2]['value'], "STAY", '断言value') # 获取风险点类型 r3 = json.loads(f.test_risk_getRiskType()) a.verity(r3['data'][0]['name'], "二押点", '断言name') a.verity(r3['data'][0]['value'], "PLEDEGREPEAT", '断言value') a.verity(r3['data'][1]['name'], "维修厂", '断言name') a.verity(r3['data'][1]['value'], "REPAIRSHOP", '断言value') a.verity(r3['data'][2]['name'], "其它", '断言name') a.verity(r3['data'][2]['value'], "OTHER", '断言value') # 新增风险点 r4 = json.loads(f.test_risk_save( str({'address': '', 'coords': '104.07331,30.659167,100', 'gisType': 'CIRCLE', 'id': '', 'name': c.riskName, 'radius': '100', 'orgCode': orgCode, 'riskType': 'PLEDEGREPEAT', 'rules': [{'id': '', 'riskId': '', 'ruleType': 'OUT'}, {'id': '', 'riskId': '', 'ruleType': 'STAY', 'thresholdMax': c.risk_thresholdMax}, {'id': '', 'riskId': '', 'ruleType': 'IN'}], 'otherRemark': ''}))) self.risk_id = fs.get_risk_id(c.riskName) a.verity(r4['data']['name'], c.riskName, '断言name') a.verity(r4['data']['orgCode'], orgCode, '断言orgCode') a.verity(r4['data']['riskType'], "PLEDEGREPEAT", '断言riskType') a.verity(r4['data']['gisType'], "CIRCLE", '断言gisType') a.verity(r4['data']['id'], self.risk_id, '断言id') a.verity(r4['data']['rules'][0]['id'], fs.get_rule_id('OUT', self.risk_id), '断言rules-id') a.verity(r4['data']['rules'][0]['ruleType'], "OUT", '断言ruleType') a.verity(r4['data']['rules'][1]['id'], fs.get_rule_id('STAY', self.risk_id), '断言rules-id') a.verity(r4['data']['rules'][1]['ruleType'], "STAY", '断言ruleType') a.verity(r4['data']['rules'][1]['thresholdMax'], c.risk_thresholdMax, '断言thresholdMax') a.verity(r4['data']['rules'][2]['id'], fs.get_rule_id('IN', self.risk_id), '断言rules-id') a.verity(r4['data']['rules'][2]['ruleType'], "IN", '断言ruleType') # 获取风险点信息列表 r5 = json.loads(f.test_risk_getRisks('', '', orgCode, 1, 10)) a.verity(r5['data']['pageNum'], 1, '断言pageNum') a.verity(r5['data']['pageSize'], 10, '断言pageSize') a.verityContain(r5['data']['record'], c.riskName) # 获取风险点详细信息 r6 = json.loads(f.test_risk_getDetail(self.risk_id)) a.verity(r6['data']['name'], c.riskName, '断言name') a.verity(r6['data']['orgCode'], orgCode, '断言orgCode') a.verity(r6['data']['riskType'], "PLEDEGREPEAT", '断言riskType') a.verity(r6['data']['gisType'], "CIRCLE", '断言gisType') a.verity(r6['data']['id'], self.risk_id, '断言id') a.verity(r6['data']['rules'][0]['id'], fs.get_rule_id('OUT', self.risk_id), '断言rules-id') a.verity(r6['data']['rules'][0]['ruleType'], "OUT", '断言ruleType') a.verity(r6['data']['rules'][0]['ruleName'], "出区域报警", '断言ruleName') a.verity(r6['data']['rules'][1]['id'], fs.get_rule_id('STAY', self.risk_id), '断言rules-id') a.verity(r6['data']['rules'][1]['ruleType'], "STAY", '断言ruleType') a.verity(r6['data']['rules'][1]['thresholdMax'], c.risk_thresholdMax, '断言thresholdMax') a.verity(r6['data']['rules'][1]['ruleName'], "停留报警", '断言ruleName') a.verity(r6['data']['rules'][2]['id'], fs.get_rule_id('IN', self.risk_id), '断言rules-id') a.verity(r6['data']['rules'][2]['ruleType'], "IN", '断言ruleType') a.verity(r6['data']['rules'][2]['ruleName'], "入区域报警", '断言ruleName') # 删除一个风险点 f.test_risk_delete(self.risk_id, orgCode)