diff --git a/tests/csapi/device_lists_test.go b/tests/csapi/device_lists_test.go index 7012efa7..64f356a2 100644 --- a/tests/csapi/device_lists_test.go +++ b/tests/csapi/device_lists_test.go @@ -125,7 +125,18 @@ func TestDeviceListUpdates(t *testing.T) { }) // The observing user must share a room with the dummy barrier user. - roomID := barry.MustCreateRoom(t, map[string]interface{}{"preset": "public_chat"}) + roomID := barry.MustCreateRoom(t, map[string]interface{}{ + "preset": "public_chat", + "initial_state": []map[string]interface{}{ + { + "type": "m.room.encryption", + "state_key": "", + "content": map[string]interface{}{ + "algorithm": "m.megolm.v1.aes-sha2", + }, + }, + }, + }) observingUser.MustJoinRoom(t, roomID, []spec.ServerName{ deployment.GetFullyQualifiedHomeserverName(t, otherHSName), }) @@ -160,7 +171,18 @@ func TestDeviceListUpdates(t *testing.T) { barrier := makeBarrier(t, deployment, alice, otherHSName) checkBobKeys := uploadNewKeys(t, bob) - roomID := alice.MustCreateRoom(t, map[string]interface{}{"preset": "public_chat"}) + roomID := alice.MustCreateRoom(t, map[string]interface{}{ + "preset": "public_chat", + "initial_state": []map[string]interface{}{ + { + "type": "m.room.encryption", + "state_key": "", + "content": map[string]interface{}{ + "algorithm": "m.megolm.v1.aes-sha2", + }, + }, + }, + }) t.Logf("%s created test room %s.", alice.UserID, roomID) // Alice performs an initial sync @@ -215,7 +237,18 @@ func TestDeviceListUpdates(t *testing.T) { barrier := makeBarrier(t, deployment, alice, otherHSName) checkBobKeys := uploadNewKeys(t, bob) - roomID := bob.MustCreateRoom(t, map[string]interface{}{"preset": "public_chat"}) + roomID := bob.MustCreateRoom(t, map[string]interface{}{ + "preset": "public_chat", + "initial_state": []map[string]interface{}{ + { + "type": "m.room.encryption", + "state_key": "", + "content": map[string]interface{}{ + "algorithm": "m.megolm.v1.aes-sha2", + }, + }, + }, + }) t.Logf("%s created test room %s.", bob.UserID, roomID) // Alice performs an initial sync @@ -268,7 +301,18 @@ func TestDeviceListUpdates(t *testing.T) { barrier := makeBarrier(t, deployment, alice, otherHSName) checkBobKeys := uploadNewKeys(t, bob) - roomID := alice.MustCreateRoom(t, map[string]interface{}{"preset": "public_chat"}) + roomID := alice.MustCreateRoom(t, map[string]interface{}{ + "preset": "public_chat", + "initial_state": []map[string]interface{}{ + { + "type": "m.room.encryption", + "state_key": "", + "content": map[string]interface{}{ + "algorithm": "m.megolm.v1.aes-sha2", + }, + }, + }, + }) t.Logf("%s created test room %s.", alice.UserID, roomID) // Bob joins the room @@ -327,7 +371,18 @@ func TestDeviceListUpdates(t *testing.T) { barrier := makeBarrier(t, deployment, alice, otherHSName) checkBobKeys := uploadNewKeys(t, bob) - roomID := bob.MustCreateRoom(t, map[string]interface{}{"preset": "public_chat"}) + roomID := bob.MustCreateRoom(t, map[string]interface{}{ + "preset": "public_chat", + "initial_state": []map[string]interface{}{ + { + "type": "m.room.encryption", + "state_key": "", + "content": map[string]interface{}{ + "algorithm": "m.megolm.v1.aes-sha2", + }, + }, + }, + }) t.Logf("%s created test room %s.", bob.UserID, roomID) // Alice joins the room @@ -386,7 +441,18 @@ func TestDeviceListUpdates(t *testing.T) { barrier := makeBarrier(t, deployment, alice, otherHSName) checkBobKeys := uploadNewKeys(t, bob) - roomID := alice.MustCreateRoom(t, map[string]interface{}{"preset": "public_chat"}) + roomID := alice.MustCreateRoom(t, map[string]interface{}{ + "preset": "public_chat", + "initial_state": []map[string]interface{}{ + { + "type": "m.room.encryption", + "state_key": "", + "content": map[string]interface{}{ + "algorithm": "m.megolm.v1.aes-sha2", + }, + }, + }, + }) t.Logf("%s created test room %s.", alice.UserID, roomID) // Bob joins the room diff --git a/tests/csapi/keychanges_test.go b/tests/csapi/keychanges_test.go index 63437bdc..84787cc7 100644 --- a/tests/csapi/keychanges_test.go +++ b/tests/csapi/keychanges_test.go @@ -32,7 +32,18 @@ func TestKeyChangesLocal(t *testing.T) { bobDeviceKeys, bobOTKs := bob.MustGenerateOneTimeKeys(t, 1) bob.MustUploadKeys(t, bobDeviceKeys, bobOTKs) - roomID := alice.MustCreateRoom(t, map[string]interface{}{"preset": "public_chat"}) + roomID := alice.MustCreateRoom(t, map[string]interface{}{ + "preset": "public_chat", + "initial_state": []map[string]interface{}{ + { + "type": "m.room.encryption", + "state_key": "", + "content": map[string]interface{}{ + "algorithm": "m.megolm.v1.aes-sha2", + }, + }, + }, + }) bob.MustJoinRoom(t, roomID, []spec.ServerName{}) nextBatch1 := alice.MustSyncUntil(t, client.SyncReq{}, client.SyncJoinedTo(bob.UserID, roomID)) @@ -45,7 +56,7 @@ func TestKeyChangesLocal(t *testing.T) { "password": password, }) // Create a new device by logging in - res := unauthedClient.MustDo(t, "POST", []string{"_matrix", "client", "r0", "login"}, reqBody) + res := unauthedClient.MustDo(t, "POST", []string{"_matrix", "client", "v3", "login"}, reqBody) loginResp := must.ParseJSON(t, res.Body) unauthedClient.AccessToken = must.GetJSONFieldStr(t, loginResp, "access_token") unauthedClient.DeviceID = must.GetJSONFieldStr(t, loginResp, "device_id") diff --git a/tests/csapi/sync_test.go b/tests/csapi/sync_test.go index 3dec9ea5..13b13764 100644 --- a/tests/csapi/sync_test.go +++ b/tests/csapi/sync_test.go @@ -405,7 +405,18 @@ func TestSync(t *testing.T) { // Regression test for https://github.com/element-hq/synapse/issues/16948 charlie := deployment.Register(t, "hs1", helpers.RegistrationOpts{LocalpartSuffix: "charlie"}) - roomID := alice.MustCreateRoom(t, map[string]interface{}{"preset": "public_chat"}) + roomID := alice.MustCreateRoom(t, map[string]interface{}{ + "preset": "public_chat", + "initial_state": []map[string]interface{}{ + { + "type": "m.room.encryption", + "state_key": "", + "content": map[string]interface{}{ + "algorithm": "m.megolm.v1.aes-sha2", + }, + }, + }, + }) aliceSyncFilter := `{ "room": { diff --git a/tests/federation_device_list_update_test.go b/tests/federation_device_list_update_test.go index 770535c8..87c7c4b5 100644 --- a/tests/federation_device_list_update_test.go +++ b/tests/federation_device_list_update_test.go @@ -206,7 +206,14 @@ func TestDeviceListsUpdateOverFederationOnRoomJoin(t *testing.T) { bob := srv.UserID("complement_bob") roomVer := gomatrixserverlib.RoomVersion("10") initalEvents := federation.InitialRoomEvents(roomVer, bob) - room := srv.MustMakeRoom(t, roomVer, initalEvents) + room := srv.MustMakeRoom(t, roomVer, append(initalEvents, federation.Event{ + Type: "m.room.encryption", + StateKey: b.Ptr(""), + Sender: bob, + Content: map[string]interface{}{ + "algorithm": "m.megolm.v1.aes-sha2", + }, + })) alice.MustJoinRoom(t, room.RoomID, []spec.ServerName{srv.ServerName()}) alice.SendEventSynced(t, room.RoomID, b.Event{ diff --git a/tests/federation_upload_keys_test.go b/tests/federation_upload_keys_test.go index 2f91485e..8af57548 100644 --- a/tests/federation_upload_keys_test.go +++ b/tests/federation_upload_keys_test.go @@ -24,7 +24,18 @@ func TestFederationKeyUploadQuery(t *testing.T) { bob := deployment.Register(t, "hs2", helpers.RegistrationOpts{}) // for device lists to be shared between alice and bob they must share a room - roomID := alice.MustCreateRoom(t, map[string]interface{}{"preset": "public_chat"}) + roomID := alice.MustCreateRoom(t, map[string]interface{}{ + "preset": "public_chat", + "initial_state": []map[string]interface{}{ + { + "type": "m.room.encryption", + "state_key": "", + "content": map[string]interface{}{ + "algorithm": "m.megolm.v1.aes-sha2", + }, + }, + }, + }) bob.MustJoinRoom(t, roomID, []spec.ServerName{ deployment.GetFullyQualifiedHomeserverName(t, "hs1"), })