From 172d3f18f656207d5b69a9d9cdedd03cfd13aabe Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 14 Mar 2026 00:31:53 +0200 Subject: [PATCH 1/2] Stop testing unspecced POST /send Signed-off-by: Tulir Asokan --- tests/csapi/invalid_test.go | 9 +++++---- tests/csapi/room_messages_test.go | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/csapi/invalid_test.go b/tests/csapi/invalid_test.go index 7d59cb6d..76f1373b 100644 --- a/tests/csapi/invalid_test.go +++ b/tests/csapi/invalid_test.go @@ -1,6 +1,7 @@ package csapi_tests import ( + "fmt" "strings" "testing" @@ -34,8 +35,8 @@ func TestJson(t *testing.T) { []byte(`{"body": 1.1}`), } - for _, testCase := range testCases { - res := alice.Do(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "send", "complement.dummy"}, client.WithJSONBody(t, testCase)) + for i, testCase := range testCases { + res := alice.Do(t, "PUT", []string{"_matrix", "client", "v3", "rooms", roomID, "send", "complement.dummy", fmt.Sprintf("invalidnum-%d", i)}, client.WithJSONBody(t, testCase)) must.MatchResponse(t, res, match.HTTPResponse{ StatusCode: 400, @@ -56,8 +57,8 @@ func TestJson(t *testing.T) { []byte(`{"body": NaN}`), } - for _, testCase := range testCases { - res := alice.Do(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "send", "complement.dummy"}, client.WithJSONBody(t, testCase)) + for i, testCase := range testCases { + res := alice.Do(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "send", "complement.dummy", fmt.Sprintf("invalidval-%d", i)}, client.WithJSONBody(t, testCase)) must.MatchResponse(t, res, match.HTTPResponse{ StatusCode: 400, diff --git a/tests/csapi/room_messages_test.go b/tests/csapi/room_messages_test.go index 4900c063..45d0b44c 100644 --- a/tests/csapi/room_messages_test.go +++ b/tests/csapi/room_messages_test.go @@ -9,6 +9,7 @@ import ( "strconv" "strings" "testing" + "time" "github.com/tidwall/gjson" @@ -22,7 +23,7 @@ import ( "github.com/matrix-org/gomatrixserverlib/spec" ) -// sytest: POST /rooms/:room_id/send/:event_type sends a message +// sytest: PUT /rooms/:room_id/send/:event_type/:txn_id sends a message // sytest: GET /rooms/:room_id/messages returns a message func TestSendAndFetchMessage(t *testing.T) { runtime.SkipIf(t, runtime.Dendrite) // flakey @@ -37,8 +38,8 @@ func TestSendAndFetchMessage(t *testing.T) { _, token := alice.MustSync(t, client.SyncReq{}) - // first use the non-txn endpoint - alice.MustDo(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "send", "m.room.message"}, client.WithJSONBody(t, map[string]interface{}{ + // first use the send endpoint + alice.MustDo(t, "PUT", []string{"_matrix", "client", "v3", "rooms", roomID, "send", "m.room.message", strconv.FormatInt(time.Now().UnixNano(), 10, 64)}, client.WithJSONBody(t, map[string]interface{}{ "msgtype": "m.text", "body": testMessage, })) From c67b4b289159a2711e96f2c6ec3e03526f2481b4 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 14 Mar 2026 20:14:55 +0200 Subject: [PATCH 2/2] Update tests/csapi/invalid_test.go --- tests/csapi/invalid_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/csapi/invalid_test.go b/tests/csapi/invalid_test.go index 76f1373b..b50a4c92 100644 --- a/tests/csapi/invalid_test.go +++ b/tests/csapi/invalid_test.go @@ -58,7 +58,7 @@ func TestJson(t *testing.T) { } for i, testCase := range testCases { - res := alice.Do(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "send", "complement.dummy", fmt.Sprintf("invalidval-%d", i)}, client.WithJSONBody(t, testCase)) + res := alice.Do(t, "PUT", []string{"_matrix", "client", "v3", "rooms", roomID, "send", "complement.dummy", fmt.Sprintf("invalidval-%d", i)}, client.WithJSONBody(t, testCase)) must.MatchResponse(t, res, match.HTTPResponse{ StatusCode: 400,