# -*- coding: utf-8 -*- #!/usr/bin/env python # adapter/delixi from apps.web.core.adapter.delixi import ChargingDelixiBox from apps.web.device.models import Device import datetime from apps.web.constant import Const from apps.web.device.models import Device def get_raw_dict(device): return {u'IMEI': device['devNo'], u'timestamp': 1554702873, u'cmd': 100, u'data': u'EE06050100080208'} def test_get_port_status_from_dev(): startTime = (datetime.datetime.now() - datetime.timedelta(minutes=3)).strftime(Const.DATETIME_FMT) port = 0 Device.update_dev_control_cache(device['devNo'], { str(port): { 'status': Const.DEV_WORK_STATUS_WORKING, 'needTime': 3 * 60, 'isStart': True, 'refunded': False, 'openId': None, 'startTime': startTime } }) ChargingDelixiBox = ChargingDelixiBox(device) ChargingDelixiBox.get_port_status_from_dev