def test_send_to_others(self): "Message is sent to all connected clients except the original sender through the incoming sockets" fakesock1 = FakeSocket() fakesock2 = FakeSocket() fakesock3 = FakeSocket() fakesock4 = FakeSocket() fakedict = {'bec': {'incoming': fakesock1, 'outgoing': fakesock2}, 'jess': {'incoming': fakesock3, 'outgoing': fakesock4}} server = Server() server.users = fakedict server.send_to_others([fakesock1, fakesock3], fakesock2, 'hello!') self.assertFalse(fakesock1.did_message_send) self.assertTrue(fakesock3.did_message_send)