(t *testing.T, opts apiTestOpts, dbType test.DBType)
| 45 | } |
| 46 | |
| 47 | func 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 | |
| 72 | func TestQueryProfile(t *testing.T) { |
| 73 | aliceAvatarURL := "mxc://example.com/alice" |
no outgoing calls
no test coverage detected