7
7
8
8
9
9
class DummyServer :
10
- """A dummy server to simulate server behavior for testing purposes."""
10
+ def __init__ (self , host , port , loglevel ):
11
+ self .host = host
12
+ self .port = port
13
+ self .loglevel = loglevel
11
14
12
- def __init__ (self , port , update_callback ):
13
- """
14
- Initialize the DummyServer with a port and update callback.
15
+ def set_fn_new_client (self , fn ):
16
+ pass
15
17
16
- Args:
17
- port (int): The port number for the dummy server.
18
- update_callback (callable): The callback function for updates.
19
- """
20
- self .port = port
21
- self .update_callback = update_callback
22
- self .started = False
18
+ def set_fn_client_left (self , fn ):
19
+ pass
23
20
24
- def start (self ):
25
- """Simulate starting the dummy server."""
26
- self .started = True
21
+ def set_fn_message_received (self , fn ):
22
+ pass
27
23
28
- def stop (self ):
29
- """Simulate stopping the dummy server."""
30
- self .started = False
24
+ def deny_new_connections (self ):
25
+ pass
26
+
27
+ def allow_new_connections (self ):
28
+ pass
29
+
30
+ def send_message (self , client , message ):
31
+ pass
32
+
33
+ def run_forever (self , threaded = True ):
34
+ pass
35
+
36
+ def shutdown_gracefully (self ):
37
+ pass
31
38
32
39
33
40
class DummyConsumer :
@@ -60,6 +67,8 @@ def stop(self):
60
67
def manager (monkeypatch ):
61
68
"""Fixture to provide a Manager instance with patched dependencies for testing."""
62
69
70
+ monkeypatch .setattr ("manager.comms.websocket_server.WebsocketServer" , DummyServer )
71
+
63
72
# Patch subprocess.check_output for ROS_DISTRO and IMAGE_TAG
64
73
def fake_check_output (cmd , * a , ** k ):
65
74
if "ROS_DISTRO" in cmd [- 1 ]:
@@ -76,11 +85,10 @@ def fake_check_output(cmd, *a, **k):
76
85
)
77
86
78
87
def dummy_run (self , start_pose = None ):
79
- print (' run around' )
88
+ print (" run around" )
80
89
81
90
monkeypatch .setattr (
82
- "manager.manager.launcher.launcher_robot.LauncherRobot.run" ,
83
- dummy_run
91
+ "manager.manager.launcher.launcher_robot.LauncherRobot.run" , dummy_run
84
92
)
85
93
86
94
# Patch os.makedirs and os.path.isdir to avoid real FS operations
0 commit comments