summary refs log tree commit diff
path: root/tests/rest/utils.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-08-26 16:03:25 +0100
committerErik Johnston <erik@matrix.org>2014-08-26 16:03:25 +0100
commitb1e98ddc093b04967dffa58a58c2bfee624870b8 (patch)
tree1b850cf728afa2f97859429b110a043bc1fdf63e /tests/rest/utils.py
parentMerge branch 'develop' of github.com:matrix-org/synapse into stream_refactor (diff)
parentAvoid double call of refresh at app startup (diff)
downloadsynapse-b1e98ddc093b04967dffa58a58c2bfee624870b8.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into stream_refactor
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