aboutsummaryrefslogtreecommitdiff
path: root/userapi/userapi_test.go
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-08-27 18:53:40 +0100
committerGitHub <noreply@github.com>2020-08-27 18:53:40 +0100
commit9af2f5f1f253a821cec660ef477c274d5cd13953 (patch)
tree998ff675429077b8db11142f15cb2fe1417f0194 /userapi/userapi_test.go
parentc0f28845f8715b13b4df8728909c7a55e0a2c63a (diff)
Remove device DB from clientapi (#1352)
* Remove device DB from clientapi * Remove device DB from startup configuration It's all an impl detail now in user API
Diffstat (limited to 'userapi/userapi_test.go')
-rw-r--r--userapi/userapi_test.go21
1 files changed, 12 insertions, 9 deletions
diff --git a/userapi/userapi_test.go b/userapi/userapi_test.go
index 548148f2..3fc97d06 100644
--- a/userapi/userapi_test.go
+++ b/userapi/userapi_test.go
@@ -15,7 +15,6 @@ import (
"github.com/matrix-org/dendrite/userapi/api"
"github.com/matrix-org/dendrite/userapi/inthttp"
"github.com/matrix-org/dendrite/userapi/storage/accounts"
- "github.com/matrix-org/dendrite/userapi/storage/devices"
"github.com/matrix-org/gomatrixserverlib"
)
@@ -23,27 +22,31 @@ const (
serverName = gomatrixserverlib.ServerName("example.com")
)
-func MustMakeInternalAPI(t *testing.T) (api.UserInternalAPI, accounts.Database, devices.Database) {
+func MustMakeInternalAPI(t *testing.T) (api.UserInternalAPI, accounts.Database) {
accountDB, err := accounts.NewDatabase(&config.DatabaseOptions{
ConnectionString: "file::memory:",
}, serverName)
if err != nil {
t.Fatalf("failed to create account DB: %s", err)
}
- deviceDB, err := devices.NewDatabase(&config.DatabaseOptions{
- ConnectionString: "file::memory:",
- }, serverName)
- if err != nil {
- t.Fatalf("failed to create device DB: %s", err)
+ cfg := &config.UserAPI{
+ DeviceDatabase: config.DatabaseOptions{
+ ConnectionString: "file::memory:",
+ MaxOpenConnections: 1,
+ MaxIdleConnections: 1,
+ },
+ Matrix: &config.Global{
+ ServerName: serverName,
+ },
}
- return userapi.NewInternalAPI(accountDB, deviceDB, serverName, nil, nil), accountDB, deviceDB
+ return userapi.NewInternalAPI(accountDB, cfg, nil, nil), accountDB
}
func TestQueryProfile(t *testing.T) {
aliceAvatarURL := "mxc://example.com/alice"
aliceDisplayName := "Alice"
- userAPI, accountDB, _ := MustMakeInternalAPI(t)
+ userAPI, accountDB := MustMakeInternalAPI(t)
_, err := accountDB.CreateAccount(context.TODO(), "alice", "foobar", "")
if err != nil {
t.Fatalf("failed to make account: %s", err)