def test_010_activate_user(self): """ Time :2019-06-18 author : 罗林 desc : 激活用户 """ FinanceSql.activate_user(user_id)
def test_001_warnOfflineThreshold_getWarnOfflineThreshold(self): # 获取当前企业的阈值 r1 = json.loads(f.test_warnOfflineThreshold_getWarnOfflineThreshold()) a.verity(r1['data']['wireId'], 1, '断言wireId') a.verity(r1['data']['wiredThresholdHour'], fs.get_threshold(1)[0], '断言wiredThresholdHour') a.verity(r1['data']['wiredThresholdMinute'], fs.get_threshold(1)[1], '断言wireId') a.verity(r1['data']['wirelessId'], 2, '断言wireId') a.verity(r1['data']['wirelessThresholdHour'], fs.get_threshold(2)[0], '断言wirelessThresholdHour') a.verity(r1['data']['wirelessThresholdMinute'], fs.get_threshold(2)[1], '断言wirelessThresholdMinute') r2 = json.loads( f.test_warnOfflineThreshold_saveNewThreshold( 1, 2, c.wiredThresholdHour, c.wiredThresholdMinute, c.wirelessThresholdHour, c.wirelessThresholdMinute)) a.verityTrue(r2['data']) r = json.loads(f.test_warnOfflineThreshold_getWarnOfflineThreshold()) a.verity(r['data']['wireId'], 1, '断言wireId') a.verity(r['data']['wiredThresholdHour'], c.wiredThresholdHour, '断言wiredThresholdHour') a.verity(r['data']['wiredThresholdMinute'], c.wiredThresholdMinute, '断言wireId') a.verity(r['data']['wirelessId'], 2, '断言wireId') a.verity(r['data']['wirelessThresholdHour'], c.wirelessThresholdHour, '断言wirelessThresholdHour') a.verity(r['data']['wirelessThresholdMinute'], c.wirelessThresholdMinute, '断言wirelessThresholdMinute')
def test_028_install_remove(self): """ Time :2019-04-08 author : 罗林 desc :删除安装记录 """ gps_finance_id = fis.get_gps_finance_id(fis.get_device_id(new_device_code), fis.get_car_info(car_owner)) rs1 = cla.test_install_remove(id=gps_finance_id) ass.verity(json.loads(rs1)['message'], '请求成功')
def test_030_del_gps(self): """ Time :2019-04-08 author : 罗林 desc : 删除数据库中的设备信息 """ gps_finance_id = fis.get_gps_finance_id(fis.get_device_id(new_device_code), fis.get_car_info(car_owner)) cls.del_gps_finance(gps_finance_id) cls.del_gps(new_device_code) fis.del_finance(car_owner)
def test_005_realtime_carRelationChange(self): """ Time :2019-06-14 author : 闫红 desc : 车辆转移 """ carid = fs.get_carid_by_id_desc() groupid = fs.get_gps_group(groupname=groupname,orgcod=orgCode) rs = f.test_realtime_carRelationChange(financelist=carid, groupid=groupid) a.verity(json.loads(rs)['code'],'F2000')
def test_023_install_add(self): """ Time :2019-04-08 author : 罗林 desc :创建安装 """ car_id = fis.get_car_id(car_owner) device_id = fis.get_device_id(new_device_code) rs1 = cla.test_install_add(carid=car_id, equipmentids=device_id, username=installer) ass.verity(json.loads(rs1)['message'], '请求成功')
def test_012_warnDist(self): # 处理报警信息页面初始化数据 finance_id = fs.get_car_id(c.car_owner) warnid = fs.get_warn_id(warn_type='jl', financeid=finance_id) f.test_warnDist_getHandleWarnMessage(warnid) # 查看设备距离报警信息 f.test_warnDist_getDeviceWarnIntervalDetail(warnid) # 获取设备距离报警记录 f.test_warnDist_getWarnIntervals('', 1, 10, 0) # 执行报警信息处理 f.test_warnDist_doHandleWarn(99, 'test 其它', 'test 备注', 3, warnid)
def test_016_realtime_mainDevice(self): """ Time :2019-06-14 author : 闫红 desc : 设置主设备 """ financeid = fs.get_warn_latest() gpsid = fs.get_gpsid_by_fid(financeid) rs = f.test_realtime_mainDevice(financeid=financeid, gpsid=gpsid) a.verity(json.loads(rs)['code'],'F2000') a.verityContain(json.loads(rs)['message'],'成功')
def test_025_install_update(self): """ Time :2019-04-08 author : 罗林 desc :修改安装 """ gps_finance_id = fis.get_gps_finance_id(fis.get_device_id(new_device_code), fis.get_car_info(car_owner)) imageid = cls.get_file_id(gps_finance_id) rs1 = cla.test_install_update(date=tf.get_now_time(), position='电瓶', imageid=imageid, username=installer, id=gps_finance_id) ass.verity(json.loads(rs1)['message'], '请求成功')
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_016_historyCarRecord(self): financeid = fs.get_car_id(c.car_owner) # 车辆档案,只读,支持finance warn monitor三个模块的权限 f.test_historyCarRecord_customerMessage(financeid) # 获取车辆的车贷数据 r = json.loads(f.test_historyCarRecord_getCarFinance(financeid)) a.verity(r['data']['owner'], c.car_owner) # 获取车辆设备页面初始化数据 f.test_historyCarRecord_getCarInit(financeid) # 获取该车辆的实时定位数据 f.test_historyCarRecord_getCarLocations(financeid) # 获取车辆的报警记录 f.test_historyCarRecord_getCarWarn(financeid, 1, 10) # 获取车辆设备的报警统计信息 f.test_historyCarRecord_getCarWarnCount(financeid) # 车辆档案--获取gps设备列表 f.test_historyCarRecord_getGpsByFid(financeid) # 车辆档案--停车统计--常停地址 f.test_historyCarRecord_listLocation( '', orgCode, '', 1, 10, financeid, c.deviceCode, c.station_starttime, c.station_endtime, 1) # 车辆档案--停车统计--时间分布 f.test_historyCarRecord_quantumLocation( 1, c.deviceCode, c.station_starttime, c.station_endtime) # 车辆档案--停车统计--停车明细 f.test_historyCarRecord_stationDetail( '', '', '', 1, 10, 1, c.deviceCode, c.station_starttime, c.station_endtime, 1)
def test_001_devices(self): """ Time :2019-03-20 上午 10:27 author : 闫红 desc :实现设备相关接口,新增设备、编辑设备、查看设备详情、获取设备类型、获取设备列表、删除设备 """ r1 = json.loads( FinanceAction.test_device_save('', '0045', 1, 'GT02D', 'ddwire10000', '1064847072526', '2019-02-27')) Assertion.verity(r1['code'], 'F2000', '断言新增设备') gps_id = FinanceSql.get_device_id('ddwire10000') r4 = json.loads( FinanceAction.test_device_update(gps_id, '0045', 1, 'GT02D', 'ddwire10000', '1064847072527', '2019-02-28')) Assertion.verity(r4['code'], 'F2000', '断言修改设备') r5 = json.loads(FinanceAction.test_device_getLowerOrg()) r6 = json.loads(FinanceAction.test_device_getDeviceMoudel(1)) Assertion.verityContain(r6['data'][0]['dictCode'], 'GT02D', '断言有线型号包含GT02D') r7 = json.loads(FinanceAction.test_device_getDeviceType()) Assertion.verity(r7['data'][0]['dictCode'], '1', '断言dictCode') Assertion.verity(r7['data'][0]['dictName'], '有线', '断言dictName') Assertion.verity(r7['data'][1]['dictCode'], '0', '断言dictCode') Assertion.verity(r7['data'][1]['dictName'], '无线', '断言dictName') r8 = json.loads(FinanceAction.test_device_detail(gps_id)) Assertion.verity(r8['data']['deviceCode'], 'ddwire10000', '断言设备号') Assertion.verity(r8['data']['id'], gps_id[0][0], '断言id') r2 = json.loads(FinanceAction.test_device_delete(gps_id)) Assertion.verityContain(r2['message'], '成功', '断言删除') r9 = json.loads(FinanceAction.test_device_list('ddwire10000', 1, 10)) Assertion.verity(r9['data']['pageNum'], 1, '断言页码') Assertion.verity(r9['data']['pageSize'], 10, '断言条码') Assertion.verityNone(r9['data']['record'], '断言删除后应该为空')
def test_014_gps(self): gpsid, gpscode = fs.get_gps()[0] finance_id = fs.get_car_id(c.car_owner) # 获取机构信息 r = json.loads(f.test_install_getLowerOrg()) a.verity(r['data'][0]['name'], c.companyName) a.verity(r['data'][0]['orgCode'], orgCode) # 获取GPS设备 f.test_install_getDevice(gpscode, orgCode) # 获取GPS类型 f.test_install_getGpsType() # 获取GPS型号 f.test_install_getGpsMoudel('有线') f.test_install_getGpsMoudel('无线') # 根据所在机构获取GPS设备信息 r1 = json.loads(f.test_install_getDeviceByOrgCode(gpsid, orgCode)) a.verityContain(r1['data'], gpscode) a.verityContain(r1['data'], str(gpsid)) # 安装车辆搜索联想 r2 = json.loads(f.test_install_installCarSearchAssociate(c.car_owner, orgCode)) a.verity(r2['data'][0]['fid'], finance_id) a.verity(r2['data'][0]['carNo'], c.carNo) a.verity(r2['data'][0]['carNoAndOwner'], c.carNo + ' ' + c.car_owner) # 设备安装 保存GPS安装记录 r3 = json.loads(f.test_install_saveGpsInstallRecord(finance_id, gpsid, '', '1', '1', tf.getnow_day())) gps_finance_id = fs.get_gps_finance_id(gpsid, finance_id) a.verity(r3['data'], gps_finance_id) # 获取GPS安装记录详情 r4 = json.loads(f.test_install_getGpsInstallDetail(gps_finance_id)) a.verity(r4['data']['id'], gps_finance_id) a.verity(r4['data']['orgCode'], orgCode) a.verity(r4['data']['financeId'], finance_id) a.verity(r4['data']['gpsId'], gpsid) a.verity(r4['data']['gpsCode'], gpscode) a.verityIn(r4['data']['installDate'], str(tf.getnow_day())) # 根据所在机构获取GPS设备信息 f.test_install_getDeviceByOrgCode('', orgCode) # 更新GPS安装记录 f.test_install_updateGpsInstallRecord(finance_id, gpsid, gps_finance_id, '2', '2', tf.getnow_day()) # Gps安装记录列表 f.test_install_findGpsInstallRecord('', 1, 10) # 拆机,将gps安装记录拆除 f.test_install_dismantle(gps_finance_id) f.test_install_saveGpsInstallRecord(finance_id, gpsid, '', '1', '1', tf.getnow_day()) gps_finance_id = fs.get_gps_finance_id(gpsid, finance_id) # 删除安装记录,安装记录出错了,将错误数据删除 f.test_install_deleteRecord(gps_finance_id)
def test_003_role_getDetail(self): # 获取角色 role_id = fs.get_role_id(c.role_name)[0][0] r1 = json.loads(f.test_role_getDetail(role_id)) a.verity(r1['data']['id'], role_id, '断言id') a.verity(r1['data']['orgCode'], orgCode, '断言orgCode') a.verity(r1['data']['name'], c.role_name, '断言name') a.verity(r1['data']['remark'], c.role_remark, '断言remark')
def test_002_monitor_updateGroup(self): """ Time :2019-06-14 author : 闫红 desc : 修改分组 """ groupid = fs.get_gps_group(groupname=groupname,orgcod=orgCode) rs = f.test_monitor_updateGroup(groupid=groupid, groupname=groupname) a.verity(json.loads(rs)['code'],'F2000')
def test_003_realtime_getCarByGroup(self): """ Time :2019-06-14 author : 闫红 desc : 查询分组下的车辆 """ groupid = fs.get_gps_group(groupname=groupname,orgcod=orgCode) rs = f.test_realtime_getCarByGroup(groupid=groupid, type=0, orgcode=orgCode, pagenum=1, pagesize=10, keyword='') a.verity(json.loads(rs)['code'],'F2000')
def test_006_realtime_deleteGroup(self): """ Time :2019-06-14 author : 闫红 desc : 删除分组 """ groupid = fs.get_gps_group(groupname=groupname,orgcod=orgCode) rs = f.test_realtime_deleteGroup(groupid=groupid) a.verity(json.loads(rs)['code'],'F2000')
def test_029_equipment_remove(self): """ Time :2019-04-08 author : 罗林 desc :删除设备 """ device_id = fis.get_device_id(new_device_code) rs1 = cla.test_equipment_remove(id=device_id) ass.verity(json.loads(rs1)['message'], '请求成功')
def test_012_warning_resolve(self): """ Time :2019-04-08 author : 罗林 desc :提交报警处理数据 """ warnid = fis.get_warn_id() rs1 = cla.test_warning_resolve(dangervalue=1, warningid=warnid, feedbackvalue=1, mark='', feedbackothertext='') ass.verity(json.loads(rs1)['message'], '请求成功')
def test_014_warning_mapinfo(self): """ Time :2019-04-08 author : 罗林 desc :获取报警详情地图信息 """ warnid = fis.get_warn_id() rs1 = cla.test_warning_mapinfo(warningid=warnid) ass.verity(json.loads(rs1)['message'], '请求成功')
def test_015_warning_stationdetail(self): """ Time :2019-04-08 author : 罗林 desc :未回家/公司获取停车记录 """ warnid = fis.get_warn_id('whj') rs1 = cla.test_warning_stationdetail(warnid=warnid) ass.verity(json.loads(rs1)['message'], '请求成功')
def test_007_device_detail(self): # 获取设备详情 device_id = fs.get_device_id(c.deviceCode) r5 = json.loads(f.test_device_detail(device_id)) a.verity(r5['data']['deviceCode'], c.deviceCode, '断言deviceCode') a.verity(r5['data']['id'], device_id[0][0], '断言device_id') a.verity(r5['data']['moudelCode'], c.devicemoudelCode, '断言moudelCode') a.verity(r5['data']['orgCode'], orgCode, '断言orgCode') a.verity(r5['data']['typeCode'], c.devicetypecode, '断言typeCode')
def test_011_warning_handleinit(self): """ Time :2019-04-08 author : 罗林 desc :动态获取情况反馈与风险等级 """ warnid = fis.get_warn_id() rs1 = cla.test_warning_handleinit(warnid=warnid) ass.verity(json.loads(rs1)['message'], '请求成功')
def test_001_role_addRole(self): # 新增角色数据 r = json.loads( f.test_role_addRole('', '', c.role_name, c.role_remark, orgCode)) role_id = fs.get_role_id(c.role_name)[0][0] a.verity(r['data']['id'], role_id, '断言id') a.verity(r['data']['name'], c.role_name, '断言name') a.verity(r['data']['orgCode'], orgCode, '断言orgCode') a.verity(r['data']['remark'], c.role_remark, '断言remark')
def test_008_finance_getDetail(self): # 获取车贷数据详情 self.car_id = fs.get_car_id(c.car_owner) r7 = json.loads(f.test_finance_getDetail(self.car_id)) a.verity(r7['data']['borrowType'], 'XZ', '断言贷款性质') a.verity(r7['data']['carNo'], c.carNo, '断言车牌号') a.verity(r7['data']['owner'], c.car_owner, '断言owner') a.verity(r7['data']['rePayManner'], 'DBDX', '断言还款方式') a.verity(r7['data']['orgCode'], orgCode, '断言orgCode') a.verity(r7['data']['id'], self.car_id[0][0], '断言车牌id')
def test_009_realtime_getWarnsByDevice(self): """ Time :2019-06-14 author : 闫红 desc : 查看设备报警 """ gpsid = fs.get_gpsid('668614460410119') rs = f.test_realtime_getWarnsByDevice(gpsid=gpsid) a.verity(json.loads(rs)['code'],'F2000') a.verityContain(json.loads(rs)['message'],'成功')
def test_009_warning_list(self): """ Time :2019-04-08 author : 罗林 desc :获取报警列表 """ devicenum = fis.get_gpscode(cls.get_device_id()) rs1 = cla.test_warning_list(pagesize=10, warningtype='', issolved='', devicenum=devicenum, keyword='', pagenum=1) ass.verity(json.loads(rs1)['message'], '请求成功')
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_007_role_updateRole(self): # 修改角色数据 role_id = fs.get_role_id(c.role_name)[0][0] r5 = json.loads( f.test_role_updateRole(0, role_id, c.role_name, c.role_remark, orgCode)) a.verity(r5['data']['id'], role_id, '断言id') a.verity(r5['data']['orgCode'], orgCode, '断言orgCode') a.verity(r5['data']['name'], c.role_name, '断言name') a.verity(r5['data']['remark'], c.role_remark, '断言remark') a.verity(r5['data']['count'], 0, '断言count')
def test_015_realtime_getDeviceByCar(self): """ Time :2019-06-14 author : 闫红 desc : 查询同车设备 """ financeid = fs.get_warn_latest() rs = f.test_realtime_getDeviceByCar(financeid=financeid) a.verity(json.loads(rs)['code'],'F2000') a.verityContain(json.loads(rs)['message'],'成功') a.verity(json.loads(rs)['data'][0]['financeId'],financeid,'断言financeid')