refactor: update GMSL (#3058)

Sister PR to https://github.com/matrix-org/gomatrixserverlib/pull/364

Read this commit by commit to avoid going insane.
This commit is contained in:
kegsay 2023-04-19 15:50:33 +01:00 committed by GitHub
parent 9fa39263c0
commit 72285b2659
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
306 changed files with 2117 additions and 1934 deletions

View file

@ -23,6 +23,7 @@ import (
"time"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/gomatrixserverlib/spec"
"github.com/nats-io/nats.go"
"github.com/stretchr/testify/assert"
"go.uber.org/atomic"
@ -39,8 +40,8 @@ import (
)
const (
testOrigin = gomatrixserverlib.ServerName("kaer.morhen")
testDestination = gomatrixserverlib.ServerName("white.orchard")
testOrigin = spec.ServerName("kaer.morhen")
testDestination = spec.ServerName("white.orchard")
)
var (
@ -235,7 +236,7 @@ func TestProcessTransactionRequestEDUTyping(t *testing.T) {
t.Errorf("failed to marshal EDU JSON")
}
badEDU := gomatrixserverlib.EDU{Type: "m.typing"}
badEDU.Content = gomatrixserverlib.RawJSON("badjson")
badEDU.Content = spec.RawJSON("badjson")
edus := []gomatrixserverlib.EDU{badEDU, edu}
ctx := process.NewProcessContext()
@ -301,7 +302,7 @@ func TestProcessTransactionRequestEDUToDevice(t *testing.T) {
t.Errorf("failed to marshal EDU JSON")
}
badEDU := gomatrixserverlib.EDU{Type: "m.direct_to_device"}
badEDU.Content = gomatrixserverlib.RawJSON("badjson")
badEDU.Content = spec.RawJSON("badjson")
edus := []gomatrixserverlib.EDU{badEDU, edu}
ctx := process.NewProcessContext()
@ -378,7 +379,7 @@ func TestProcessTransactionRequestEDUDeviceListUpdate(t *testing.T) {
t.Errorf("failed to marshal EDU JSON")
}
badEDU := gomatrixserverlib.EDU{Type: "m.device_list_update"}
badEDU.Content = gomatrixserverlib.RawJSON("badjson")
badEDU.Content = spec.RawJSON("badjson")
edus := []gomatrixserverlib.EDU{badEDU, edu}
ctx := process.NewProcessContext()
@ -441,7 +442,7 @@ func TestProcessTransactionRequestEDUReceipt(t *testing.T) {
t.Errorf("failed to marshal EDU JSON")
}
badEDU := gomatrixserverlib.EDU{Type: "m.receipt"}
badEDU.Content = gomatrixserverlib.RawJSON("badjson")
badEDU.Content = spec.RawJSON("badjson")
badUser := gomatrixserverlib.EDU{Type: "m.receipt"}
if badUser.Content, err = json.Marshal(map[string]interface{}{
roomID: map[string]interface{}{
@ -519,7 +520,7 @@ func TestProcessTransactionRequestEDUSigningKeyUpdate(t *testing.T) {
t.Errorf("failed to marshal EDU JSON")
}
badEDU := gomatrixserverlib.EDU{Type: "m.signing_key_update"}
badEDU.Content = gomatrixserverlib.RawJSON("badjson")
badEDU.Content = spec.RawJSON("badjson")
edus := []gomatrixserverlib.EDU{badEDU, edu}
ctx := process.NewProcessContext()
@ -576,7 +577,7 @@ func TestProcessTransactionRequestEDUPresence(t *testing.T) {
t.Errorf("failed to marshal EDU JSON")
}
badEDU := gomatrixserverlib.EDU{Type: "m.presence"}
badEDU.Content = gomatrixserverlib.RawJSON("badjson")
badEDU.Content = spec.RawJSON("badjson")
edus := []gomatrixserverlib.EDU{badEDU, edu}
ctx := process.NewProcessContext()