MCPcopy Create free account
hub / github.com/daodst/chat / MustMakeInternalAPI

Function MustMakeInternalAPI

userapi/userapi_test.go:47–70  ·  view source on GitHub ↗
(t *testing.T, opts apiTestOpts, dbType test.DBType)

Source from the content-addressed store, hash-verified

45}
46
47func MustMakeInternalAPI(t *testing.T, opts apiTestOpts, dbType test.DBType) (api.UserInternalAPI, storage.Database, func()) {
48 if opts.loginTokenLifetime == 0 {
49 opts.loginTokenLifetime = api.DefaultLoginTokenLifetime * time.Millisecond
50 }
51 connStr, close := test.PrepareDBConnectionString(t, dbType)
52
53 accountDB, err := storage.NewUserAPIDatabase(nil, &config.DatabaseOptions{
54 ConnectionString: config.DataSource(connStr),
55 }, serverName, bcrypt.MinCost, config.DefaultOpenIDTokenLifetimeMS, opts.loginTokenLifetime, "")
56 if err != nil {
57 t.Fatalf("failed to create account DB: %s", err)
58 }
59
60 cfg := &config.UserAPI{
61 Matrix: &config.Global{
62 ServerName: serverName,
63 },
64 }
65
66 return &internal.UserInternalAPI{
67 DB: accountDB,
68 ServerName: cfg.Matrix.ServerName,
69 }, accountDB, close
70}
71
72func TestQueryProfile(t *testing.T) {
73 aliceAvatarURL := "mxc://example.com/alice"

Callers 2

TestQueryProfileFunction · 0.85
TestLoginTokenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected