aboutsummaryrefslogtreecommitdiff
path: root/userapi/userapi_test.go
diff options
context:
space:
mode:
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)