summary refs log tree commit diff
path: root/tests/unittest.py
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-07-17 20:43:18 +1000
committerGitHub <noreply@github.com>2018-07-17 20:43:18 +1000
commitbc006b3c9d2a9982bc834ff5d1ec1768c85f907a (patch)
tree748864a2aea695a58739c381fb9785a739845972 /tests/unittest.py
parentMerge pull request #3544 from matrix-org/erikj/fixup_stream_cache (diff)
downloadsynapse-bc006b3c9d2a9982bc834ff5d1ec1768c85f907a.tar.xz
Refactor REST API tests to use explicit reactors (#3351)
Diffstat (limited to 'tests/unittest.py')
-rw-r--r--tests/unittest.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unittest.py b/tests/unittest.py
index b25f2db5d5..b15b06726b 100644
--- a/tests/unittest.py
+++ b/tests/unittest.py
@@ -109,6 +109,17 @@ class TestCase(unittest.TestCase):
             except AssertionError as e:
                 raise (type(e))(e.message + " for '.%s'" % key)
 
+    def assert_dict(self, required, actual):
+        """Does a partial assert of a dict.
+
+        Args:
+            required (dict): The keys and value which MUST be in 'actual'.
+            actual (dict): The test result. Extra keys will not be checked.
+        """
+        for key in required:
+            self.assertEquals(required[key], actual[key],
+                              msg="%s mismatch. %s" % (key, actual))
+
 
 def DEBUG(target):
     """A decorator to set the .loglevel attribute to logging.DEBUG.