@@ -158,14 +158,8 @@ func TestRoomMembers(t *testing.T) {
158158 })
159159
160160 alice .MustSyncUntil (t , client.SyncReq {}, client .SyncJoinedTo (bob .UserID , roomID ))
161- res = alice .Do (t , "GET" , []string {"_matrix" , "client" , "v3" , "rooms" , roomID , "state" , "m.room.member" , bob .UserID })
162-
163- must .MatchResponse (t , res , match.HTTPResponse {
164- JSON : []match.JSON {
165- match .JSONKeyEqual ("foo" , "bar" ),
166- match .JSONKeyEqual ("membership" , "join" ),
167- },
168- })
161+ content := alice .MustGetStateEventContent (t , roomID , "m.room.member" , bob .UserID )
162+ must .MatchGJSON (t , content , match .JSONKeyEqual ("membership" , "join" ), match .JSONKeyEqual ("foo" , "bar" ))
169163 })
170164 // sytest: POST /join/:room_alias can join a room with custom content
171165 t .Run ("POST /join/:room_alias can join a room with custom content" , func (t * testing.T ) {
@@ -187,14 +181,8 @@ func TestRoomMembers(t *testing.T) {
187181 })
188182
189183 alice .MustSyncUntil (t , client.SyncReq {}, client .SyncJoinedTo (bob .UserID , roomID ))
190- res = alice .Do (t , "GET" , []string {"_matrix" , "client" , "v3" , "rooms" , roomID , "state" , "m.room.member" , bob .UserID })
191-
192- must .MatchResponse (t , res , match.HTTPResponse {
193- JSON : []match.JSON {
194- match .JSONKeyEqual ("foo" , "bar" ),
195- match .JSONKeyEqual ("membership" , "join" ),
196- },
197- })
184+ content := alice .MustGetStateEventContent (t , roomID , "m.room.member" , bob .UserID )
185+ must .MatchGJSON (t , content , match .JSONKeyEqual ("membership" , "join" ), match .JSONKeyEqual ("foo" , "bar" ))
198186 })
199187
200188 // sytest: POST /rooms/:room_id/ban can ban a user
@@ -222,12 +210,8 @@ func TestRoomMembers(t *testing.T) {
222210 return ev .Get ("content.membership" ).Str == "ban"
223211 }))
224212 // verify bob is banned
225- res = alice .Do (t , "GET" , []string {"_matrix" , "client" , "v3" , "rooms" , roomID , "state" , "m.room.member" , bob .UserID })
226- must .MatchResponse (t , res , match.HTTPResponse {
227- JSON : []match.JSON {
228- match .JSONKeyEqual ("membership" , "ban" ),
229- },
230- })
213+ content := alice .MustGetStateEventContent (t , roomID , "m.room.member" , bob .UserID )
214+ must .MatchGJSON (t , content , match .JSONKeyEqual ("membership" , "ban" ))
231215 })
232216
233217 // sytest: POST /rooms/:room_id/invite can send an invite
@@ -236,12 +220,8 @@ func TestRoomMembers(t *testing.T) {
236220 roomID := alice .MustCreateRoom (t , map [string ]interface {}{})
237221 alice .MustInviteRoom (t , roomID , bob .UserID )
238222 alice .MustSyncUntil (t , client.SyncReq {}, client .SyncInvitedTo (bob .UserID , roomID ))
239- res := alice .Do (t , "GET" , []string {"_matrix" , "client" , "v3" , "rooms" , roomID , "state" , "m.room.member" , bob .UserID })
240- must .MatchResponse (t , res , match.HTTPResponse {
241- JSON : []match.JSON {
242- match .JSONKeyEqual ("membership" , "invite" ),
243- },
244- })
223+ content := alice .MustGetStateEventContent (t , roomID , "m.room.member" , bob .UserID )
224+ must .MatchGJSON (t , content , match .JSONKeyEqual ("membership" , "invite" ))
245225 })
246226
247227 // sytest: POST /rooms/:room_id/leave can leave a room
@@ -254,13 +234,8 @@ func TestRoomMembers(t *testing.T) {
254234 alice .MustSyncUntil (t , client.SyncReq {}, client .SyncJoinedTo (bob .UserID , roomID ))
255235 bob .MustLeaveRoom (t , roomID )
256236 alice .MustSyncUntil (t , client.SyncReq {}, client .SyncLeftFrom (bob .UserID , roomID ))
257-
258- res := alice .Do (t , "GET" , []string {"_matrix" , "client" , "v3" , "rooms" , roomID , "state" , "m.room.member" , bob .UserID })
259- must .MatchResponse (t , res , match.HTTPResponse {
260- JSON : []match.JSON {
261- match .JSONKeyEqual ("membership" , "leave" ),
262- },
263- })
237+ content := alice .MustGetStateEventContent (t , roomID , "m.room.member" , bob .UserID )
238+ must .MatchGJSON (t , content , match .JSONKeyEqual ("membership" , "leave" ))
264239 })
265240 })
266241}
0 commit comments