def test_get_room_charge_list(self, payload):
     '''获取房间充值记录列表'''
     payload['path'] = payload['path'].format(Homes.room_id)
     payload['params']['startTime'] = Common.format_timestamp(1000, -5)
     payload['params']['endTime'] = Common.format_timestamp()
     res = Common.check(self, payload)
     self.assertEqual(res.status_code, 200)
 def test_add_ticket_2(self, payload):
     '''调用saasapi接口增加维修工单以便后面验证客服受理接口'''
     host = 'https://qa-saas.dding.net'
     payload['params']['faults'][0]['fault_time'] = Common.format_timestamp()
     res = Common.check(self, payload, host)
     Tickets.ticket2_id = res.json().get('result').get('id')
     Tickets.ticket2_sn = res.json().get('result').get('ticket_sn')
 def accept_ticket(self, ticket_id, payload):
     '''确定预约时间'''
     tmp = payload.copy()
     tmp['path'] = tmp['path'].format(ticket_id)
     tmp['params']['appointment_time'] = Common.format_timestamp()
     tmp['params']['ticket_id'] = ticket_id
     Common.check(self, tmp)
 def test_update_ticket_3(self, payload):
     '''编辑拆卸工单'''
     payload['path'] = payload['path'].format(Tickets.ticket3_id)
     payload['params']['faults'][0]['id'] = Tickets.ticket3_device_id
     payload['params']['faults'][0]['ticket_id'] = Tickets.ticket3_id
     payload['params']['faults'][0]['fault_time'] = Common.format_timestamp() + 100000000
     Common.check(self, payload)
 def test_add_ticket_1(self, payload):
     '''增加新装工单'''
     payload['params']['subscribe']['expected_time'] = Common.format_timestamp()
     res = Common.check(self, payload)
     if payload['desc'] == '增加新装工单':
         Tickets.ticket1_id = res.json().get('result').get('id')
         Tickets.ticket1_sn = res.json().get('result').get('ticket_sn')
     elif payload['desc'] == '增加无网关门锁新装工单':
         Tickets.ticket1_lock_id = res.json().get('result').get('id')
         Tickets.ticket1_lock_sn = res.json().get('result').get('ticket_sn')
     else:
         pass
 def test_add_ticket_4(self, payload):
     '''增加重装工单'''
     payload['params']['subscribe']['expected_time'] = Common.format_timestamp()
     res = Common.check(self, payload)
     Tickets.ticket4_id = res.json().get('result').get('id')
     Tickets.ticket4_sn = res.json().get('result').get('ticket_sn')
 def test_update_ticket_1(self, payload):
     '''编辑新装工单'''
     payload['path'] = payload['path'].format(Tickets.ticket1_id)
     payload['params']['subscribe']['expected_time'] = Common.format_timestamp() + 100000000
     Common.check(self, payload)
 def test_get_room_electric_record(self, payload):
     '''获取房间用电记录'''
     payload['path'] = payload['path'].format(Homes.room_id)
     payload['params']['start_time'] = Common.format_timestamp(1000, -5)
     payload['params']['end_time'] = Common.format_timestamp()
     Common.check(self, payload)
 def test_export_room_charge_list(self, payload):
     '''导出房间充值记录列表'''
     payload['path'] = payload['path'].format(Homes.room_id)
     payload['params']['startTime'] = Common.format_timestamp(1000, -5)
     payload['params']['endTime'] = Common.format_timestamp()
     Common.check(self, payload)