def __init__(self): self.my_serial = serial_manager.SerialSetup() self.my_device = serial_manager.SerialData() self.parser = reqparse.RequestParser() self.parser.add_argument('serial_device', help='串口数据设置', location='json')
def test_post(self): response = self.client.post('/api/serial/setting/device/active_device/' + '测试1', headers=util.headers) result = self.client.get('/api/serial/setting/device/active_device/') my_serial_data = serial_manager.SerialData() self.assertEqual(my_serial_data.serial_virtual_device['active_device'], '测试1') self.assertEqual({'测试1': True}, json.loads(response.data)) self.assertEqual({'active_device': '测试1'}, json.loads(result.data))
def setUp(self): self.client = get_test_client() self.name = 'serial_active_device' self.send_data = { '测试1': [ {defines.RECEIVE_DATA: 'receive1\r\n', defines.SEND_DATA: 'send1\r\n'}, {defines.RECEIVE_DATA: 'receive2\r\n', defines.SEND_DATA: 'send2\r\n'}, {defines.RECEIVE_DATA: 'receive3\r\n', defines.SEND_DATA: 'send3\r\n'}, {defines.RECEIVE_DATA: 'receive4\r\n', defines.SEND_DATA: 'send4\r\n'}, ], '测试2': [ {defines.RECEIVE_DATA: 'receiveA\r\n', defines.SEND_DATA: 'sendA\r\n'}, {defines.RECEIVE_DATA: 'receiveB\r\n', defines.SEND_DATA: 'sendB\r\n'}, {defines.RECEIVE_DATA: 'receiveC\r\n', defines.SEND_DATA: 'sendC\r\n'}, ] } data = json.dumps({'serial_device': self.send_data}, ensure_ascii=False) self.client.post('/api/serial/setting/device/', headers=util.headers, data=data) self.my_serial_data = serial_manager.SerialData()
def setUp(self): self.client = get_test_client() self.name = 'serial_device' self.my_serial_data = serial_manager.SerialData()
def setUp(self): self.client = get_test_client() self.my_serial_setting = serial_manager.SerialSetup() self.my_serial_data = serial_manager.SerialData()
def setUp(self): self.my_ser = serial_manager.SerialSetup() self.my_data = serial_manager.SerialData()
def setUp(self): self.my_serial = serial_manager.SerialSetup() self.my_data = serial_manager.SerialData() self.my_response = serial_manager.ResponseRequests( self.my_serial.get_serial()) pass
def __init__(self): self.my_serial = serial_manager.SerialSetup() self.my_device = serial_manager.SerialData() self.parser = reqparse.RequestParser() self.parser.add_argument('serial_service')
def __init__(self): self.my_device = serial_manager.SerialData()