File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import os
2+
3+ import infuse_iot .socket_comms as comms
4+
5+ assert "TOXTEMPDIR" in os .environ , "you must run these tests using tox"
6+
7+
8+ def test_socket_comms ():
9+ # Ensure notifications can be sent from the server to the client, and requests sent in reverse
10+ mulicast_addr = comms .default_multicast_address ()
11+ server = comms .LocalServer (mulicast_addr )
12+ client = comms .LocalClient (mulicast_addr )
13+
14+ # Send request to server
15+ request = comms .GatewayRequestCommsCheck ()
16+ client .send (request )
17+
18+ # Server receives request, responds
19+ recv_req = server .receive ()
20+ assert isinstance (recv_req , comms .GatewayRequestCommsCheck )
21+ response = comms .ClientNotificationCommsCheck ()
22+ server .broadcast (response )
23+
24+ # Client receives the response
25+ recv_rsp = client .receive ()
26+ assert isinstance (recv_rsp , comms .ClientNotificationCommsCheck )
You can’t perform that action at this time.
0 commit comments