def test_get_client(self, mock_client, mock_ser): rpc.TRANSPORT = mock.Mock() tgt = mock.Mock() ser = mock.Mock() mock_client.return_value = 'client' mock_ser.return_value = ser client = rpc.get_client(tgt, version_cap='1.0', serializer='foo') mock_ser.assert_called_once_with('foo') mock_client.assert_called_once_with(rpc.TRANSPORT, tgt, version_cap='1.0', serializer=ser) self.assertEqual('client', client)
def __init__(self): super(EngineAPI, self).__init__() target = messaging.Target(topic=self.TOPIC, version=self.RPC_API_VERSION) serializer = objects_base.MasakariObjectSerializer() self.client = rpc.get_client(target, serializer=serializer)