remove 'response' result from `_get_shared_rooms`
This commit is contained in:
parent
7eebe4b3fc
commit
0378581c13
|
@ -17,6 +17,7 @@ from synapse.rest.client.v1 import login, room
|
||||||
from synapse.rest.client.v2_alpha import shared_rooms
|
from synapse.rest.client.v2_alpha import shared_rooms
|
||||||
|
|
||||||
from tests import unittest
|
from tests import unittest
|
||||||
|
from tests.server import FakeChannel
|
||||||
|
|
||||||
|
|
||||||
class UserSharedRoomsTest(unittest.HomeserverTestCase):
|
class UserSharedRoomsTest(unittest.HomeserverTestCase):
|
||||||
|
@ -40,14 +41,14 @@ class UserSharedRoomsTest(unittest.HomeserverTestCase):
|
||||||
self.store = hs.get_datastore()
|
self.store = hs.get_datastore()
|
||||||
self.handler = hs.get_user_directory_handler()
|
self.handler = hs.get_user_directory_handler()
|
||||||
|
|
||||||
def _get_shared_rooms(self, token, other_user):
|
def _get_shared_rooms(self, token, other_user) -> FakeChannel:
|
||||||
request, channel = self.make_request(
|
_, channel = self.make_request(
|
||||||
"GET",
|
"GET",
|
||||||
"/_matrix/client/unstable/uk.half-shot.msc2666/user/shared_rooms/%s"
|
"/_matrix/client/unstable/uk.half-shot.msc2666/user/shared_rooms/%s"
|
||||||
% other_user,
|
% other_user,
|
||||||
access_token=token,
|
access_token=token,
|
||||||
)
|
)
|
||||||
return request, channel
|
return channel
|
||||||
|
|
||||||
def test_shared_room_list_public(self):
|
def test_shared_room_list_public(self):
|
||||||
"""
|
"""
|
||||||
|
@ -63,7 +64,7 @@ class UserSharedRoomsTest(unittest.HomeserverTestCase):
|
||||||
self.helper.invite(room, src=u1, targ=u2, tok=u1_token)
|
self.helper.invite(room, src=u1, targ=u2, tok=u1_token)
|
||||||
self.helper.join(room, user=u2, tok=u2_token)
|
self.helper.join(room, user=u2, tok=u2_token)
|
||||||
|
|
||||||
request, channel = self._get_shared_rooms(u1_token, u2)
|
channel = self._get_shared_rooms(u1_token, u2)
|
||||||
self.assertEquals(200, channel.code, channel.result)
|
self.assertEquals(200, channel.code, channel.result)
|
||||||
self.assertEquals(len(channel.json_body["joined"]), 1)
|
self.assertEquals(len(channel.json_body["joined"]), 1)
|
||||||
self.assertEquals(channel.json_body["joined"][0], room)
|
self.assertEquals(channel.json_body["joined"][0], room)
|
||||||
|
@ -82,7 +83,7 @@ class UserSharedRoomsTest(unittest.HomeserverTestCase):
|
||||||
self.helper.invite(room, src=u1, targ=u2, tok=u1_token)
|
self.helper.invite(room, src=u1, targ=u2, tok=u1_token)
|
||||||
self.helper.join(room, user=u2, tok=u2_token)
|
self.helper.join(room, user=u2, tok=u2_token)
|
||||||
|
|
||||||
request, channel = self._get_shared_rooms(u1_token, u2)
|
channel = self._get_shared_rooms(u1_token, u2)
|
||||||
self.assertEquals(200, channel.code, channel.result)
|
self.assertEquals(200, channel.code, channel.result)
|
||||||
self.assertEquals(len(channel.json_body["joined"]), 1)
|
self.assertEquals(len(channel.json_body["joined"]), 1)
|
||||||
self.assertEquals(channel.json_body["joined"][0], room)
|
self.assertEquals(channel.json_body["joined"][0], room)
|
||||||
|
@ -104,7 +105,7 @@ class UserSharedRoomsTest(unittest.HomeserverTestCase):
|
||||||
self.helper.join(room_public, user=u2, tok=u2_token)
|
self.helper.join(room_public, user=u2, tok=u2_token)
|
||||||
self.helper.join(room_private, user=u1, tok=u1_token)
|
self.helper.join(room_private, user=u1, tok=u1_token)
|
||||||
|
|
||||||
request, channel = self._get_shared_rooms(u1_token, u2)
|
channel = self._get_shared_rooms(u1_token, u2)
|
||||||
self.assertEquals(200, channel.code, channel.result)
|
self.assertEquals(200, channel.code, channel.result)
|
||||||
self.assertEquals(len(channel.json_body["joined"]), 2)
|
self.assertEquals(len(channel.json_body["joined"]), 2)
|
||||||
self.assertTrue(room_public in channel.json_body["joined"])
|
self.assertTrue(room_public in channel.json_body["joined"])
|
||||||
|
@ -125,13 +126,13 @@ class UserSharedRoomsTest(unittest.HomeserverTestCase):
|
||||||
self.helper.join(room, user=u2, tok=u2_token)
|
self.helper.join(room, user=u2, tok=u2_token)
|
||||||
|
|
||||||
# Assert user directory is not empty
|
# Assert user directory is not empty
|
||||||
request, channel = self._get_shared_rooms(u1_token, u2)
|
channel = self._get_shared_rooms(u1_token, u2)
|
||||||
self.assertEquals(200, channel.code, channel.result)
|
self.assertEquals(200, channel.code, channel.result)
|
||||||
self.assertEquals(len(channel.json_body["joined"]), 1)
|
self.assertEquals(len(channel.json_body["joined"]), 1)
|
||||||
self.assertEquals(channel.json_body["joined"][0], room)
|
self.assertEquals(channel.json_body["joined"][0], room)
|
||||||
|
|
||||||
self.helper.leave(room, user=u1, tok=u1_token)
|
self.helper.leave(room, user=u1, tok=u1_token)
|
||||||
|
|
||||||
request, channel = self._get_shared_rooms(u2_token, u1)
|
channel = self._get_shared_rooms(u2_token, u1)
|
||||||
self.assertEquals(200, channel.code, channel.result)
|
self.assertEquals(200, channel.code, channel.result)
|
||||||
self.assertEquals(len(channel.json_body["joined"]), 0)
|
self.assertEquals(len(channel.json_body["joined"]), 0)
|
||||||
|
|
Loading…
Reference in New Issue