summary refs log tree commit diff
path: root/tests/rest/utils.py
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-08-26 15:54:25 +0100
committerKegan Dougal <kegan@matrix.org>2014-08-26 15:54:25 +0100
commit8bd55cfdcb206afce1a92eb198d25cf40f439b38 (patch)
treeb17b729c814b73e3d50c2c794024a0da3a6d55dc /tests/rest/utils.py
parentMerge branch 'develop' of github.com:matrix-org/synapse into client_server_ur... (diff)
downloadsynapse-8bd55cfdcb206afce1a92eb198d25cf40f439b38.tar.xz
Fix ALL THE UNIT TESTS
Diffstat (limited to 'tests/rest/utils.py')
-rw-r--r--tests/rest/utils.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/rest/utils.py b/tests/rest/utils.py
index 8ed228b218..bc8bff0f1a 100644
--- a/tests/rest/utils.py
+++ b/tests/rest/utils.py
@@ -21,6 +21,7 @@ from twisted.trial import unittest
 
 from synapse.api.constants import Membership
 
+import json
 import time
 
 class RestTestCase(unittest.TestCase):
@@ -71,23 +72,22 @@ class RestTestCase(unittest.TestCase):
                                      expect_code=expect_code)
 
     @defer.inlineCallbacks
-    def change_membership(self, room=None, src=None, targ=None,
-                          membership=None, expect_code=200, tok=None):
+    def change_membership(self, room, src, targ, membership, tok=None,
+                          expect_code=200):
         temp_id = self.auth_user_id
         self.auth_user_id = src
 
-        path = "/rooms/%s/members/%s/state" % (room, targ)
+        path = "/rooms/%s/state/m.room.member/%s" % (room, targ)
         if tok:
             path = path + "?access_token=%s" % tok
 
-        if membership == Membership.LEAVE:
-            (code, response) = yield self.mock_resource.trigger("DELETE", path,
-                                    None)
-            self.assertEquals(expect_code, code, msg=str(response))
-        else:
-            (code, response) = yield self.mock_resource.trigger("PUT", path,
-                                    '{"membership":"%s"}' % membership)
-            self.assertEquals(expect_code, code, msg=str(response))
+        data = {
+            "membership": membership
+        }
+
+        (code, response) = yield self.mock_resource.trigger("PUT", path,
+            json.dumps(data))
+        self.assertEquals(expect_code, code, msg=str(response))
 
         self.auth_user_id = temp_id