2022-09-02 21:30:50 +02:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/sirupsen/logrus"
|
2022-10-04 12:27:40 +02:00
|
|
|
"github.com/urfave/cli"
|
2022-09-28 09:01:17 +02:00
|
|
|
|
|
|
|
"github.com/photoprism/photoprism/internal/config"
|
|
|
|
"github.com/photoprism/photoprism/internal/event"
|
2022-10-04 12:27:40 +02:00
|
|
|
"github.com/photoprism/photoprism/internal/service"
|
2022-09-02 21:30:50 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestMain(m *testing.M) {
|
|
|
|
log = logrus.StandardLogger()
|
|
|
|
log.SetLevel(logrus.TraceLevel)
|
2022-09-28 09:01:17 +02:00
|
|
|
event.AuditLog = log
|
2022-09-02 21:30:50 +02:00
|
|
|
|
|
|
|
c := config.NewTestConfig("commands")
|
2022-10-04 12:27:40 +02:00
|
|
|
service.SetConfig(c)
|
2022-09-02 21:30:50 +02:00
|
|
|
|
2022-10-04 12:27:40 +02:00
|
|
|
InitConfig = func(ctx *cli.Context) (*config.Config, error) {
|
|
|
|
return c, c.Init()
|
|
|
|
}
|
2022-09-02 21:30:50 +02:00
|
|
|
|
2022-10-04 12:27:40 +02:00
|
|
|
code := m.Run()
|
2022-09-02 21:30:50 +02:00
|
|
|
|
|
|
|
os.Exit(code)
|
|
|
|
}
|