diff options
author | Russell Bryant <rbryant@redhat.com> | 2013-06-10 21:44:22 -0400 |
---|---|---|
committer | Russell Bryant <rbryant@redhat.com> | 2013-06-11 14:30:46 -0400 |
commit | 80476f0c6e70e23102495e383e98ae0e912e07f6 (patch) | |
tree | 71d0fc46e397704b5466001a8c0770d400bc66a3 /tests | |
parent | 165b98415d3949f8a9dddbdbc1f304fb7d257718 (diff) | |
download | oslo-80476f0c6e70e23102495e383e98ae0e912e07f6.tar.gz oslo-80476f0c6e70e23102495e383e98ae0e912e07f6.tar.xz oslo-80476f0c6e70e23102495e383e98ae0e912e07f6.zip |
Add can_send_version() to RpcProxy.
Add a helper method to the RpcProxy class. This is a little nicer to
use for checking to see if a given message is copmatible with the set
version cap.
Change-Id: Ic44d76f4181351dff367f2d1181a3d508a11db78
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/rpc/test_proxy.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/unit/rpc/test_proxy.py b/tests/unit/rpc/test_proxy.py index 9427cbe..9f67c83 100644 --- a/tests/unit/rpc/test_proxy.py +++ b/tests/unit/rpc/test_proxy.py @@ -209,3 +209,13 @@ class RpcProxyTestCase(utils.BaseTestCase): msg = rpc_proxy.make_msg('foo', a=1, b=2) result = rpc_proxy.call(ctxt, msg) self.assertEqual(result, 'worked!') + + def test_can_send_version(self): + proxy_obj = proxy.RpcProxy('fake', '1.0', version_cap='1.5') + self.assertTrue(proxy_obj.can_send_version('1.5')) + self.assertFalse(proxy_obj.can_send_version('1.6')) + + def test_can_send_version_with_no_cap(self): + proxy_obj = proxy.RpcProxy('fake', '1.0') + self.assertTrue(proxy_obj.can_send_version('1.5')) + self.assertTrue(proxy_obj.can_send_version('1.99')) |