Skip to content

Commit

Permalink
Add tests to verify ?chunk_id actually corresponds to an insertion ev…
Browse files Browse the repository at this point in the history
…ent that exists

Add tests for:

 - matrix-org/synapse#10776
  • Loading branch information
MadLittleMods committed Sep 7, 2021
1 parent 0a215fe commit 09b4a4b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/msc2716_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,29 @@ func TestBackfillingHistory(t *testing.T) {
)
})

t.Run("Unrecognised chunk_id will throw an error", func(t *testing.T) {
t.Parallel()

roomID := as.CreateRoom(t, createPublicRoomOpts)
alice.JoinRoom(t, roomID, nil)

eventIDsBefore := createMessagesInRoom(t, alice, roomID, 1)
eventIdBefore := eventIDsBefore[0]
timeAfterEventBefore := time.Now()

batchSendHistoricalMessages(
t,
as,
roomID,
eventIdBefore,
"XXX_DOES_NOT_EXIST_CHUNK_ID",
createJoinStateEventsForBackfillRequest([]string{virtualUserID}, timeAfterEventBefore),
createMessageEventsForBackfillRequest([]string{virtualUserID}, timeAfterEventBefore, 1),
// Status
400,
)
})

t.Run("Normal users aren't allowed to backfill messages", func(t *testing.T) {
t.Parallel()

Expand Down

0 comments on commit 09b4a4b

Please sign in to comment.