Skip to content

Commit

Permalink
Always specify a preset (#166)
Browse files Browse the repository at this point in the history
* Always specify a preset

Synapse and Dendrite disagree what the join rules are if this is omitted.
Dendrite follows the spec, Synapse doesn't. Nontheless, we should be
specific in tests.

* Don't use map[string]interface{}

Whilst most of the time this is fine, it isn't in v1 paths which
return `[$status_code, $json_object]`. Use `interface{}` instead.

* Set public_chat on knocking msc
  • Loading branch information
kegsay authored Jul 19, 2021
1 parent 08c1002 commit 3eaa989
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/federation_room_join_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,9 @@ func TestCannotSendNonLeaveViaSendLeaveV2(t *testing.T) {
// and checks that they are all rejected.
func testValidationForSendMembershipEndpoint(t *testing.T, baseApiPath, expectedMembership string, createRoomOpts map[string]interface{}) {
if createRoomOpts == nil {
createRoomOpts = make(map[string]interface{})
createRoomOpts = map[string]interface{}{
"preset": "public_chat",
}
}

deployment := Deploy(t, b.BlueprintAlice)
Expand Down Expand Up @@ -324,7 +326,7 @@ func testValidationForSendMembershipEndpoint(t *testing.T, baseApiPath, expected
return
}

var res map[string]interface{}
var res interface{}
err := srv.SendFederationRequest(deployment, req, &res)
if err == nil {
t.Errorf("send request returned 200")
Expand Down
1 change: 1 addition & 0 deletions tests/msc2403_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ func publishAndCheckRoomJoinRule(t *testing.T, c *client.CSAPI, roomID, expected
func TestCannotSendNonKnockViaSendKnock(t *testing.T) {
testValidationForSendMembershipEndpoint(t, "/_matrix/federation/v1/send_knock", "knock",
map[string]interface{}{
"preset": "public_chat",
"room_version": "7",
},
)
Expand Down

0 comments on commit 3eaa989

Please sign in to comment.