Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions tests/csapi/invalid_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package csapi_tests

import (
"fmt"
"strings"
"testing"

Expand Down Expand Up @@ -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,
Expand All @@ -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, "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,
Expand Down
7 changes: 4 additions & 3 deletions tests/csapi/room_messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"strconv"
"strings"
"testing"
"time"

"github.com/tidwall/gjson"

Expand All @@ -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
Expand All @@ -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,
}))
Expand Down
Loading