summaryrefslogtreecommitdiff
path: root/heat/tests/utils.py
diff options
context:
space:
mode:
authorricolin <rico.lin@easystack.cn>2018-04-01 20:59:07 +0800
committerZane Bitter <zbitter@redhat.com>2018-04-11 11:11:41 -0400
commitdd111b161528936e09aff356e735076b0b20e7c4 (patch)
treefdfcfc708a8a9b376280b68ac7413b9d94550862 /heat/tests/utils.py
parent2c63287420c7d8e90641cd90ea4d1dd6ab743625 (diff)
downloadheat-dd111b161528936e09aff356e735076b0b20e7c4.tar.gz
Remove mox usage from test_api_ec2token
Change-Id: Ia62a2bf62d88d0641406b183ae912e8cfc1010f4 goal: mox-removal
Diffstat (limited to 'heat/tests/utils.py')
-rw-r--r--heat/tests/utils.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/heat/tests/utils.py b/heat/tests/utils.py
index 208c852f1..98f01575e 100644
--- a/heat/tests/utils.py
+++ b/heat/tests/utils.py
@@ -16,7 +16,6 @@ import string
import uuid
import fixtures
-import mox
from oslo_config import cfg
from oslo_db import options
from oslo_serialization import jsonutils
@@ -173,21 +172,25 @@ def recursive_sort(obj):
return obj
-class JsonEquals(mox.Comparator):
- """Comparison class used to check if two json strings equal.
+class JsonRepr(object):
+ """Comparison class used to check the deserialisation of a JSON string.
If a dict is dumped to json, the order is undecided, so load the string
- back to an object for comparison
+ back to an object for comparison.
"""
- def __init__(self, other_json):
- self.other_json = other_json
+ def __init__(self, data):
+ """Initialise with the unserialised data."""
+ self._data = data
- def equals(self, rhs):
- return jsonutils.loads(self.other_json) == jsonutils.loads(rhs)
+ def __eq__(self, json_data):
+ return self._data == jsonutils.loads(json_data)
+
+ def __ne__(self, json_data):
+ return not self.__eq__(json_data)
def __repr__(self):
- return "<equals to json '%s'>" % self.other_json
+ return jsonutils.dumps(self._data)
class ForeignKeyConstraintFixture(fixtures.Fixture):