@@ -244,6 +244,29 @@ def test_emit_to_room(self):
244244 '456' , 'my event' , {'foo' : 'bar' }, '/foo' , None
245245 )
246246
247+ def test_emit_to_rooms (self ):
248+ sid1 = self .bm .connect ('123' , '/foo' )
249+ self .bm .enter_room (sid1 , '/foo' , 'bar' )
250+ sid2 = self .bm .connect ('456' , '/foo' )
251+ self .bm .enter_room (sid2 , '/foo' , 'bar' )
252+ self .bm .enter_room (sid2 , '/foo' , 'baz' )
253+ sid3 = self .bm .connect ('789' , '/foo' )
254+ self .bm .enter_room (sid3 , '/foo' , 'baz' )
255+ _run (
256+ self .bm .emit ('my event' , {'foo' : 'bar' }, namespace = '/foo' ,
257+ room = ['bar' , 'baz' ])
258+ )
259+ assert self .bm .server ._emit_internal .mock .call_count == 3
260+ self .bm .server ._emit_internal .mock .assert_any_call (
261+ '123' , 'my event' , {'foo' : 'bar' }, '/foo' , None
262+ )
263+ self .bm .server ._emit_internal .mock .assert_any_call (
264+ '456' , 'my event' , {'foo' : 'bar' }, '/foo' , None
265+ )
266+ self .bm .server ._emit_internal .mock .assert_any_call (
267+ '789' , 'my event' , {'foo' : 'bar' }, '/foo' , None
268+ )
269+
247270 def test_emit_to_all (self ):
248271 sid1 = self .bm .connect ('123' , '/foo' )
249272 self .bm .enter_room (sid1 , '/foo' , 'bar' )
0 commit comments