@@ -157,14 +157,8 @@ func TestRoomMembers(t *testing.T) {
157157 })
158158
159159 alice .MustSyncUntil (t , client.SyncReq {}, client .SyncJoinedTo (bob .UserID , roomID ))
160- res = alice .Do (t , "GET" , []string {"_matrix" , "client" , "v3" , "rooms" , roomID , "state" , "m.room.member" , bob .UserID })
161-
162- must .MatchResponse (t , res , match.HTTPResponse {
163- JSON : []match.JSON {
164- match .JSONKeyEqual ("foo" , "bar" ),
165- match .JSONKeyEqual ("membership" , "join" ),
166- },
167- })
160+ content := alice .MustGetStateEventContent (t , roomID , "m.room.member" , bob .UserID )
161+ must .MatchGJSON (t , content , match .JSONKeyEqual ("membership" , "join" ), match .JSONKeyEqual ("foo" , "bar" ))
168162 })
169163 // sytest: POST /join/:room_alias can join a room with custom content
170164 t .Run ("POST /join/:room_alias can join a room with custom content" , func (t * testing.T ) {
@@ -186,14 +180,8 @@ func TestRoomMembers(t *testing.T) {
186180 })
187181
188182 alice .MustSyncUntil (t , client.SyncReq {}, client .SyncJoinedTo (bob .UserID , roomID ))
189- res = alice .Do (t , "GET" , []string {"_matrix" , "client" , "v3" , "rooms" , roomID , "state" , "m.room.member" , bob .UserID })
190-
191- must .MatchResponse (t , res , match.HTTPResponse {
192- JSON : []match.JSON {
193- match .JSONKeyEqual ("foo" , "bar" ),
194- match .JSONKeyEqual ("membership" , "join" ),
195- },
196- })
183+ content := alice .MustGetStateEventContent (t , roomID , "m.room.member" , bob .UserID )
184+ must .MatchGJSON (t , content , match .JSONKeyEqual ("membership" , "join" ), match .JSONKeyEqual ("foo" , "bar" ))
197185 })
198186
199187 // sytest: POST /rooms/:room_id/ban can ban a user
@@ -221,12 +209,8 @@ func TestRoomMembers(t *testing.T) {
221209 return ev .Get ("content.membership" ).Str == "ban"
222210 }))
223211 // verify bob is banned
224- res = alice .Do (t , "GET" , []string {"_matrix" , "client" , "v3" , "rooms" , roomID , "state" , "m.room.member" , bob .UserID })
225- must .MatchResponse (t , res , match.HTTPResponse {
226- JSON : []match.JSON {
227- match .JSONKeyEqual ("membership" , "ban" ),
228- },
229- })
212+ content := alice .MustGetStateEventContent (t , roomID , "m.room.member" , bob .UserID )
213+ must .MatchGJSON (t , content , match .JSONKeyEqual ("membership" , "ban" ))
230214 })
231215
232216 // sytest: POST /rooms/:room_id/invite can send an invite
@@ -235,12 +219,8 @@ func TestRoomMembers(t *testing.T) {
235219 roomID := alice .MustCreateRoom (t , map [string ]interface {}{})
236220 alice .MustInviteRoom (t , roomID , bob .UserID )
237221 alice .MustSyncUntil (t , client.SyncReq {}, client .SyncInvitedTo (bob .UserID , roomID ))
238- res := alice .Do (t , "GET" , []string {"_matrix" , "client" , "v3" , "rooms" , roomID , "state" , "m.room.member" , bob .UserID })
239- must .MatchResponse (t , res , match.HTTPResponse {
240- JSON : []match.JSON {
241- match .JSONKeyEqual ("membership" , "invite" ),
242- },
243- })
222+ content := alice .MustGetStateEventContent (t , roomID , "m.room.member" , bob .UserID )
223+ must .MatchGJSON (t , content , match .JSONKeyEqual ("membership" , "invite" ))
244224 })
245225
246226 // sytest: POST /rooms/:room_id/leave can leave a room
@@ -253,13 +233,8 @@ func TestRoomMembers(t *testing.T) {
253233 alice .MustSyncUntil (t , client.SyncReq {}, client .SyncJoinedTo (bob .UserID , roomID ))
254234 bob .MustLeaveRoom (t , roomID )
255235 alice .MustSyncUntil (t , client.SyncReq {}, client .SyncLeftFrom (bob .UserID , roomID ))
256-
257- res := alice .Do (t , "GET" , []string {"_matrix" , "client" , "v3" , "rooms" , roomID , "state" , "m.room.member" , bob .UserID })
258- must .MatchResponse (t , res , match.HTTPResponse {
259- JSON : []match.JSON {
260- match .JSONKeyEqual ("membership" , "leave" ),
261- },
262- })
236+ content := alice .MustGetStateEventContent (t , roomID , "m.room.member" , bob .UserID )
237+ must .MatchGJSON (t , content , match .JSONKeyEqual ("membership" , "leave" ))
263238 })
264239 })
265240}
0 commit comments