Return a dummy /versions response in tests

Otherwise every integration test logs a warning that isn't useful.
This commit is contained in:
David Robertson 2023-09-28 12:17:07 +01:00
parent 6fe9b18f8c
commit 1079ec6aed
No known key found for this signature in database
GPG Key ID: 903ECE108A39DEDD

View File

@ -243,6 +243,10 @@ func runTestV2Server(t testutils.TestBenchInterface) *testV2Server {
timeToWaitForV2Response: time.Second,
}
r := mux.NewRouter()
r.HandleFunc("/_matrix/client/versions", func(w http.ResponseWriter, req *http.Request) {
w.WriteHeader(200)
w.Write([]byte(`{"versions": ["v1.1"]}`))
})
r.HandleFunc("/_matrix/client/r0/account/whoami", func(w http.ResponseWriter, req *http.Request) {
token := strings.TrimPrefix(req.Header.Get("Authorization"), "Bearer ")
userID := server.userID(token)