From 6929a729877e3577a26c50f0b1dbeca6724d889d Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Mon, 10 Jun 2013 12:04:13 +0100 Subject: [PATCH] Implement Target.__eq__() Needed for unit tests, but probably useful for other cases too. --- openstack/common/messaging/target.py | 3 +++ tests/unit/messaging/test_rpc_client.py | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 tests/unit/messaging/test_rpc_client.py diff --git a/openstack/common/messaging/target.py b/openstack/common/messaging/target.py index 5f3d23e8e..21b7d36cd 100644 --- a/openstack/common/messaging/target.py +++ b/openstack/common/messaging/target.py @@ -77,6 +77,9 @@ class Target(object): kwargs.setdefault('fanout', self.fanout) return Target(**kwargs) + def __eq__(self, other): + return vars(self) == vars(other) + def __repr__(self): attrs = [] for a in ['exchange', 'topic', 'namespace', diff --git a/tests/unit/messaging/test_rpc_client.py b/tests/unit/messaging/test_rpc_client.py new file mode 100644 index 000000000..4f0c2fe93 --- /dev/null +++ b/tests/unit/messaging/test_rpc_client.py @@ -0,0 +1,16 @@ + +# Copyright 2013 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +