setupAPIForTest creates a new API to run tests with. Using this function allows us to keep track of the database connection and cleaning up data between tests.
(opts ...Option)
| 30 | // Using this function allows us to keep track of the database connection |
| 31 | // and cleaning up data between tests. |
| 32 | func setupAPIForTest(opts ...Option) (*API, *conf.GlobalConfiguration, error) { |
| 33 | config, err := confload.LoadGlobal(apiTestConfig) |
| 34 | if err != nil { |
| 35 | return nil, nil, err |
| 36 | } |
| 37 | |
| 38 | conn, err := test.SetupDBConnection(config) |
| 39 | if err != nil { |
| 40 | return nil, nil, err |
| 41 | } |
| 42 | |
| 43 | return NewAPIWithVersion(config, conn, apiTestVersion, opts...), config, nil |
| 44 | } |
| 45 | |
| 46 | func setupAPIForTestWithCallback(cb func(*conf.GlobalConfiguration, *storage.Connection)) (*API, *conf.GlobalConfiguration, error) { |
| 47 | config, err := confload.LoadGlobal(apiTestConfig) |
no test coverage detected