diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-08-26 16:07:05 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-08-26 16:07:05 +0100 |
commit | 4b63b06cad3e72e3d3dee66d3d6c7801e4a7abaf (patch) | |
tree | 37b368d6039d986d70f153fb69d6345d1019d64a /tests/rest/utils.py | |
parent | fix a few pyflakes errors (diff) | |
parent | Fix pyflakes errors (diff) | |
download | synapse-4b63b06cad3e72e3d3dee66d3d6c7801e4a7abaf.tar.xz |
Merge branch 'develop' into storage_transactions
Conflicts: synapse/api/auth.py synapse/handlers/room.py synapse/storage/__init__.py
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 |