14
14
from twisted .test .proto_helpers import MemoryReactor
15
15
16
16
import synapse .rest .admin
17
- from synapse .rest .client import login , room , shared_rooms
17
+ from synapse .rest .client import login , mutual_rooms , room
18
18
from synapse .server import HomeServer
19
19
from synapse .util import Clock
20
20
21
21
from tests import unittest
22
22
from tests .server import FakeChannel
23
23
24
24
25
- class UserSharedRoomsTest (unittest .HomeserverTestCase ):
25
+ class UserMutualRoomsTest (unittest .HomeserverTestCase ):
26
26
"""
27
- Tests the UserSharedRoomsServlet .
27
+ Tests the UserMutualRoomsServlet .
28
28
"""
29
29
30
30
servlets = [
31
31
login .register_servlets ,
32
32
synapse .rest .admin .register_servlets_for_client_rest_resource ,
33
33
room .register_servlets ,
34
- shared_rooms .register_servlets ,
34
+ mutual_rooms .register_servlets ,
35
35
]
36
36
37
37
def make_homeserver (self , reactor : MemoryReactor , clock : Clock ) -> HomeServer :
@@ -43,10 +43,10 @@ def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
43
43
self .store = hs .get_datastores ().main
44
44
self .handler = hs .get_user_directory_handler ()
45
45
46
- def _get_shared_rooms (self , token : str , other_user : str ) -> FakeChannel :
46
+ def _get_mutual_rooms (self , token : str , other_user : str ) -> FakeChannel :
47
47
return self .make_request (
48
48
"GET" ,
49
- "/_matrix/client/unstable/uk.half-shot.msc2666/user/shared_rooms /%s"
49
+ "/_matrix/client/unstable/uk.half-shot.msc2666/user/mutual_rooms /%s"
50
50
% other_user ,
51
51
access_token = token ,
52
52
)
@@ -56,14 +56,14 @@ def test_shared_room_list_public(self) -> None:
56
56
A room should show up in the shared list of rooms between two users
57
57
if it is public.
58
58
"""
59
- self ._check_shared_rooms_with (room_one_is_public = True , room_two_is_public = True )
59
+ self ._check_mutual_rooms_with (room_one_is_public = True , room_two_is_public = True )
60
60
61
61
def test_shared_room_list_private (self ) -> None :
62
62
"""
63
63
A room should show up in the shared list of rooms between two users
64
64
if it is private.
65
65
"""
66
- self ._check_shared_rooms_with (
66
+ self ._check_mutual_rooms_with (
67
67
room_one_is_public = False , room_two_is_public = False
68
68
)
69
69
@@ -72,9 +72,9 @@ def test_shared_room_list_mixed(self) -> None:
72
72
The shared room list between two users should contain both public and private
73
73
rooms.
74
74
"""
75
- self ._check_shared_rooms_with (room_one_is_public = True , room_two_is_public = False )
75
+ self ._check_mutual_rooms_with (room_one_is_public = True , room_two_is_public = False )
76
76
77
- def _check_shared_rooms_with (
77
+ def _check_mutual_rooms_with (
78
78
self , room_one_is_public : bool , room_two_is_public : bool
79
79
) -> None :
80
80
"""Checks that shared public or private rooms between two users appear in
@@ -94,7 +94,7 @@ def _check_shared_rooms_with(
94
94
95
95
# Check shared rooms from user1's perspective.
96
96
# We should see the one room in common
97
- channel = self ._get_shared_rooms (u1_token , u2 )
97
+ channel = self ._get_mutual_rooms (u1_token , u2 )
98
98
self .assertEqual (200 , channel .code , channel .result )
99
99
self .assertEqual (len (channel .json_body ["joined" ]), 1 )
100
100
self .assertEqual (channel .json_body ["joined" ][0 ], room_id_one )
@@ -107,7 +107,7 @@ def _check_shared_rooms_with(
107
107
self .helper .join (room_id_two , user = u2 , tok = u2_token )
108
108
109
109
# Check shared rooms again. We should now see both rooms.
110
- channel = self ._get_shared_rooms (u1_token , u2 )
110
+ channel = self ._get_mutual_rooms (u1_token , u2 )
111
111
self .assertEqual (200 , channel .code , channel .result )
112
112
self .assertEqual (len (channel .json_body ["joined" ]), 2 )
113
113
for room_id_id in channel .json_body ["joined" ]:
@@ -128,19 +128,19 @@ def test_shared_room_list_after_leave(self) -> None:
128
128
self .helper .join (room , user = u2 , tok = u2_token )
129
129
130
130
# Assert user directory is not empty
131
- channel = self ._get_shared_rooms (u1_token , u2 )
131
+ channel = self ._get_mutual_rooms (u1_token , u2 )
132
132
self .assertEqual (200 , channel .code , channel .result )
133
133
self .assertEqual (len (channel .json_body ["joined" ]), 1 )
134
134
self .assertEqual (channel .json_body ["joined" ][0 ], room )
135
135
136
136
self .helper .leave (room , user = u1 , tok = u1_token )
137
137
138
138
# Check user1's view of shared rooms with user2
139
- channel = self ._get_shared_rooms (u1_token , u2 )
139
+ channel = self ._get_mutual_rooms (u1_token , u2 )
140
140
self .assertEqual (200 , channel .code , channel .result )
141
141
self .assertEqual (len (channel .json_body ["joined" ]), 0 )
142
142
143
143
# Check user2's view of shared rooms with user1
144
- channel = self ._get_shared_rooms (u2_token , u1 )
144
+ channel = self ._get_mutual_rooms (u2_token , u1 )
145
145
self .assertEqual (200 , channel .code , channel .result )
146
146
self .assertEqual (len (channel .json_body ["joined" ]), 0 )
0 commit comments