Skip to content

Commit

Permalink
Add test to make sure /messages behaves as expected for non-existent …
Browse files Browse the repository at this point in the history
…room_ids

Tests for Synapse regression fix: matrix-org/synapse#12683
Issue: matrix-org/synapse#12678
  • Loading branch information
MadLittleMods committed May 10, 2022
1 parent 8035f8b commit 0237a5e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/csapi/room_messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,25 @@ func TestSendAndFetchMessage(t *testing.T) {
})
}

// With a non-existent room_id, GET /rooms/:room_id/messages returns 403
// forbidden.
func TestFetchMessagesFromNonExistentRoom(t *testing.T) {
runtime.SkipIf(t, runtime.Dendrite) // flakey
deployment := Deploy(t, b.BlueprintAlice)
defer deployment.Destroy(t)

alice := deployment.Client(t, "hs1", "@alice:hs1")
roomID := "!does-not-exist:hs1"

// then request messages from the room
queryParams := url.Values{}
queryParams.Set("dir", "b")
res := alice.DoFunc(t, "GET", []string{"_matrix", "client", "r0", "rooms", roomID, "messages"}, client.WithQueries(queryParams))
must.MatchResponse(t, res, match.HTTPResponse{
StatusCode: http.StatusForbidden,
})
}

// sytest: PUT /rooms/:room_id/send/:event_type/:txn_id sends a message
// sytest: PUT /rooms/:room_id/send/:event_type/:txn_id deduplicates the same txn id
func TestSendMessageWithTxn(t *testing.T) {
Expand Down

0 comments on commit 0237a5e

Please sign in to comment.