(cb func(*conf.GlobalConfiguration, *conf.Configuration, *storage.Connection) (uuid.UUID, error))
| 58 | } |
| 59 | |
| 60 | func setupAPIForTestWithCallback(cb func(*conf.GlobalConfiguration, *conf.Configuration, *storage.Connection) (uuid.UUID, error)) (*API, *conf.Configuration, error) { |
| 61 | globalConfig, err := conf.LoadGlobal(apiTestConfig) |
| 62 | if err != nil { |
| 63 | return nil, nil, err |
| 64 | } |
| 65 | |
| 66 | conn, err := test.SetupDBConnection(globalConfig) |
| 67 | if err != nil { |
| 68 | return nil, nil, err |
| 69 | } |
| 70 | |
| 71 | config, err := conf.LoadConfig(apiTestConfig) |
| 72 | if err != nil { |
| 73 | conn.Close() |
| 74 | return nil, nil, err |
| 75 | } |
| 76 | |
| 77 | instanceID := uuid.Nil |
| 78 | if cb != nil { |
| 79 | instanceID, err = cb(globalConfig, config, conn) |
| 80 | if err != nil { |
| 81 | conn.Close() |
| 82 | return nil, nil, err |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | ctx, err := WithInstanceConfig(context.Background(), config, instanceID) |
| 87 | if err != nil { |
| 88 | conn.Close() |
| 89 | return nil, nil, err |
| 90 | } |
| 91 | |
| 92 | return NewAPIWithVersion(ctx, globalConfig, conn, apiTestVersion), config, nil |
| 93 | } |
| 94 | |
| 95 | func TestEmailEnabledByDefault(t *testing.T) { |
| 96 | api, _, err := setupAPIForTest() |
no test coverage detected
searching dependent graphs…