Commands: Refactor "show config-options" and "show config-yaml" tests

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2024-07-01 08:58:39 +02:00
parent 3005d83baf
commit d25b555dbc
6 changed files with 61 additions and 7 deletions

View File

@@ -20,8 +20,8 @@ func TestMain(m *testing.M) {
c := config.NewTestConfig("commands")
get.SetConfig(c)
defer c.CloseDb()
// Init config and connect to database.
InitConfig = func(ctx *cli.Context) (*config.Config, error) {
return c, c.Init()
}
@@ -29,6 +29,9 @@ func TestMain(m *testing.M) {
// Run unit tests.
code := m.Run()
// Close database connection.
c.CloseDb()
os.Exit(code)
}