Skip to content

Commit fc1222e

Browse files
committed
add callback to capture returned message, add new test for serial
1 parent 48cc695 commit fc1222e

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

test/test_ws.py

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
1-
import asyncio
2-
import socketio as io
1+
import socketio
32
import time
43

54
def test_ws_connection(agent, socketio):
65
print('my sid is', socketio.sid)
76
assert socketio.sid is not None
87

98
def test_list(agent, socketio):
9+
socketio.on('message', message_handler)
1010
socketio.emit('command', 'list')
11-
11+
time.sleep(.1)
12+
13+
def test__open_serial_default(agent, socketio):
14+
socketio.on('message', message_handler)
15+
socketio.emit('command', 'open /dev/ttyACM0 9600')
16+
time.sleep(.1)
17+
socketio.emit('command', 'send /dev/ttyACM0 /"ciao/"')
18+
time.sleep(.1)
19+
socketio.emit('command', 'close /dev/ttyACM0')
20+
time.sleep(.1)
21+
22+
23+
def message_handler(msg):
24+
print('Received message: ', msg)

0 commit comments

Comments
 (0)