diff options
author | Kegan Dougal <kegan@matrix.org> | 2014-08-26 15:55:01 +0100 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2014-08-26 15:55:01 +0100 |
commit | 0e7a41dc99952f72d6253cc529bfe4f428447865 (patch) | |
tree | 0ec5426dda5ee358a7c9915a3bc620e4600bda7f /tests/rest/utils.py | |
parent | Determine and send user presence state (diff) | |
parent | Fix ALL THE UNIT TESTS (diff) | |
download | synapse-0e7a41dc99952f72d6253cc529bfe4f428447865.tar.xz |
Merge branch 'client_server_url_rename' into develop
Diffstat (limited to 'tests/rest/utils.py')
-rw-r--r-- | tests/rest/utils.py | 22 |
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 |