Simple RPCClient test
This commit is contained in:
parent
62dcede6b6
commit
2f1ef1ffe3
|
@ -80,6 +80,9 @@ class Target(object):
|
|||
def __eq__(self, other):
|
||||
return vars(self) == vars(other)
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
def __repr__(self):
|
||||
attrs = []
|
||||
for a in ['exchange', 'topic', 'namespace',
|
||||
|
|
|
@ -13,4 +13,33 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from openstack.common import messaging
|
||||
from tests import utils as test_utils
|
||||
|
||||
|
||||
class _FakeTransport(object):
|
||||
|
||||
def __init__(self, conf):
|
||||
self.conf = conf
|
||||
|
||||
def _send(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
class TestRPCClient(test_utils.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestRPCClient, self).setUp(conf=cfg.ConfigOpts())
|
||||
|
||||
def test_rpc_client(self):
|
||||
transport = _FakeTransport(self.conf)
|
||||
client = messaging.RPCClient(transport, messaging.Target())
|
||||
|
||||
self.mox.StubOutWithMock(transport, '_send')
|
||||
transport._send(messaging.Target(), {},
|
||||
dict(method='foo', args={}))
|
||||
self.mox.ReplayAll()
|
||||
|
||||
client.cast({}, 'foo')
|
||||
|
|
Loading…
Reference in New Issue