示例#1
0
 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'], '断言删除后应该为空')
示例#2
0
 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_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')
示例#4
0
 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'], '请求成功')
示例#5
0
 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)
示例#6
0
 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'], '请求成功')
示例#7
0
 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'], '请求成功')
示例#8
0
 def test_018_equipment_update(self):
     """
     Time       :2019-04-08
     author     : 罗林
     desc       :新增设备/编辑设备
     """
     device_id = fis.get_device_id(new_device_code)
     model = json.loads(cla.test_equipment_model(type=1))["data"][-1]["code"]
     rs1 = cla.test_equipment_update(sim=sim, model=model, organizationid=org_id, type=1, no=new_device_code,
                                     id=device_id, instoragedate=tf.get_now_time())
     ass.verity(json.loads(rs1)['message'], '请求成功')
示例#9
0
 def test_001_device(self):
     # 获取设备类型信息
     r1 = json.loads(f.test_device_getDeviceType())
     a.verity(r1['data'][0]['dictCode'], '1', '断言dictCode')
     a.verity(r1['data'][0]['dictName'], '有线', '断言dictName')
     a.verity(r1['data'][0]['id'], 20, '断言id')
     a.verity(r1['data'][1]['dictCode'], '0', '断言dictCode')
     a.verity(r1['data'][1]['dictName'], '无线', '断言dictName')
     a.verity(r1['data'][1]['id'], 21, '断言id')
     # 获取设备型号信息
     r2 = json.loads(f.test_device_getDeviceMoudel(''))
     a.verity(r2['data'][0]['dictLevel'], 0, '断言dictLevel')
     a.verity(r2['data'][0]['dictName'], 'TK115', '断言dictName')
     a.verity(r2['data'][0]['id'], 22, '断言id')
     a.verity(r2['data'][1]['dictLevel'], 1, '断言dictLevel')
     a.verity(r2['data'][1]['dictName'], 'SZ-K3', '断言dictName')
     a.verity(r2['data'][1]['id'], 23, '断言id')
     a.verity(r2['data'][2]['dictLevel'], 1, '断言dictLevel')
     a.verity(r2['data'][2]['dictName'], 'GV25', '断言dictName')
     a.verity(r2['data'][2]['id'], 54, '断言id')
     a.verity(r2['data'][3]['dictLevel'], 0, '断言dictLevel')
     a.verity(r2['data'][3]['dictName'], 'GT740', '断言dictName')
     a.verity(r2['data'][3]['id'], 55, '断言id')
     # 获取机构信息
     r3 = json.loads(f.test_device_getLowerOrg())
     a.verity(r3['data'][0]['orgCode'], orgCode, '断言orgCode')
     a.verity(r3['data'][0]['name'], c.companyName, '断言组织机构名称')
     # 保存设备记录
     f.test_device_save('', orgCode, c.devicetypecode,
                        c.devicemoudelCode, c.deviceCode, '001', tf.getnow_day())
     device_id = fs.get_device_id(c.deviceCode)
     # 更新设备记录
     f.test_device_update(device_id, orgCode, c.devicetypecode,
                          c.devicemoudelCode, c.deviceCode, '001', tf.getnow_day())
     # 设备列表
     r4 = json.loads(f.test_device_list('', 1, 10))
     a.verity(r4['data']['pageNum'], 1, '断言pageNum')
     a.verity(r4['data']['pageSize'], 10, '断言pageSize')
     a.verityContain(r4['data']['record'], c.deviceCode, '断言修改后的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, '断言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')
     # 删除设备记录
     f.test_device_delete(device_id)
示例#10
0
 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_008_device_delete(self):
     device_id = fs.get_device_id(c.deviceCode)
     # 删除设备记录
     f.test_device_delete(device_id)
 def test_005_device_update(self):
     device_id = fs.get_device_id(c.deviceCode)
     # 更新设备记录
     f.test_device_update(device_id, orgCode, c.devicetypecode,
                          c.devicemoudelCode, c.deviceCode, '001',
                          tf.getnow_day())