def assert_receives_object(self, sock, id): reply = None while reply is None or reply.event != None: reply = read_object_with_timeout(sock, select=select) self.assertIsNotNone(reply) self.assertEquals(reply.id, id)
def test_server_delivers_to_specified_recipient(self): client, routing_id = self.clients[0] to_client, to_routing_id = self.clients[1] obj = BusinessObject({'to': to_routing_id}, None) obj.serialize(socket=client) self.assert_receives_object(to_client, obj.id) for client, routing_id in self.clients[2:]: reply = read_object_with_timeout(client, timeout_secs=0.1, select=select) if reply is not None: self.assertIsNotNone(reply.event) while reply is not None and reply.event is not None: reply = read_object_with_timeout(client, timeout_secs=0.1, select=select) self.assertIsNone(reply)
def test_server_doesnt_deliver_when_no_echo(self): client, routing_id = self.make_subscribe_client(no_echo=True) obj = BusinessObject({}, None) obj.serialize(socket=client) reply = read_object_with_timeout(client, timeout_secs=0.1, select=select) self.assertIsNone(reply) client.close()