Exemple #1
0
 def __init__(self, context=None, topic=None, server=None,
              timeout=None):
     self._context = context
     if topic is None:
         topic = ''
     target = messaging.Target(topic=topic, server=server)
     self._client = rpc.get_client(
         target,
         serializer=objects_base.MagnumObjectSerializer(),
         timeout=timeout
     )
Exemple #2
0
    def test_get_client_profiler_enabled(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',
                                timeout=6969)

        mock_ser.assert_called_once_with('foo')
        mock_client.assert_called_once_with(rpc.TRANSPORT,
                                            tgt, version_cap='1.0',
                                            serializer=ser, timeout=6969)
        self.assertEqual('client', client)