Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add empty request bodies to /forget calls in TestRoomForget #652

Merged
merged 2 commits into from
Sep 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions tests/csapi/apidoc_room_forget_test.go
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ func TestRoomForget(t *testing.T) {
t.Run("Can't forget room you're still in", func(t *testing.T) {
t.Parallel()
roomID := alice.CreateRoom(t, map[string]interface{}{"preset": "private_chat"})
res := alice.DoFunc(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "forget"})
res := alice.DoFunc(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "forget"}, client.WithJSONBody(t, struct{}{}))
must.MatchResponse(t, res, match.HTTPResponse{
StatusCode: http.StatusBadRequest,
JSON: []match.JSON{
@@ -47,7 +47,7 @@ func TestRoomForget(t *testing.T) {
},
})
alice.LeaveRoom(t, roomID)
alice.MustDoFunc(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "forget"})
alice.MustDoFunc(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "forget"}, client.WithJSONBody(t, struct{}{}))
res := alice.DoFunc(t, "GET", []string{"_matrix", "client", "v3", "rooms", roomID, "messages"})
must.MatchResponse(t, res, match.HTTPResponse{
StatusCode: http.StatusForbidden,
@@ -71,7 +71,7 @@ func TestRoomForget(t *testing.T) {
alice.LeaveRoom(t, roomID)
// Ensure Alice left the room
bob.MustSyncUntil(t, client.SyncReq{}, client.SyncLeftFrom(alice.UserID, roomID))
alice.MustDoFunc(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "forget"})
alice.MustDoFunc(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "forget"}, client.WithJSONBody(t, struct{}{}))
bob.SendEventSynced(t, roomID, b.Event{
Type: "m.room.message",
Content: map[string]interface{}{
@@ -117,7 +117,7 @@ func TestRoomForget(t *testing.T) {
alice.LeaveRoom(t, roomID)
// Ensure Alice left the room
bob.MustSyncUntil(t, client.SyncReq{}, client.SyncLeftFrom(alice.UserID, roomID))
alice.MustDoFunc(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "forget"})
alice.MustDoFunc(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "forget"}, client.WithJSONBody(t, struct{}{}))
bob.SendEventSynced(t, roomID, b.Event{
Type: "m.room.message",
Content: map[string]interface{}{
@@ -197,9 +197,9 @@ func TestRoomForget(t *testing.T) {
bob.LeaveRoom(t, roomID)
// Ensure Bob has really left the room
alice.MustSyncUntil(t, client.SyncReq{}, client.SyncLeftFrom(bob.UserID, roomID))
bob.MustDoFunc(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "forget"})
bob.MustDoFunc(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "forget"}, client.WithJSONBody(t, struct{}{}))
// Try to re-join
joinRes := bob.DoFunc(t, "POST", []string{"_matrix", "client", "v3", "join", roomID})
joinRes := bob.DoFunc(t, "POST", []string{"_matrix", "client", "v3", "join", roomID}, client.WithJSONBody(t, struct{}{}))
must.MatchResponse(t, joinRes, match.HTTPResponse{
StatusCode: http.StatusForbidden,
JSON: []match.JSON{
@@ -251,11 +251,11 @@ func TestRoomForget(t *testing.T) {
// Bob rejects the invite
bob.LeaveRoom(t, roomID)
// Bob tries to forget about this room
bob.MustDoFunc(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "forget"})
bob.MustDoFunc(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "forget"}, client.WithJSONBody(t, struct{}{}))
// Alice also leaves the room
alice.LeaveRoom(t, roomID)
// Alice tries to forget about this room
alice.MustDoFunc(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "forget"})
alice.MustDoFunc(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "forget"}, client.WithJSONBody(t, struct{}{}))
})
})
}