photoprism/internal/commands/config_test.go
Michael Mayer 9872cfaa50 Add ConfigCommand test #58
- Includes refactoring of existing packages to enable testing of commands
2018-11-17 13:57:19 +01:00

34 lines
966 B
Go

package commands
import (
"testing"
"github.com/photoprism/photoprism/internal/test"
"github.com/stretchr/testify/assert"
)
func TestConfigCommand(t *testing.T) {
var err error
ctx := test.CliContext()
output := test.Capture(func() {
err = ConfigCommand.Run(ctx)
})
expected := `NAME VALUE
debug false
config-file /go/src/github.com/photoprism/photoprism/configs/photoprism.yml
darktable-cli /usr/bin/darktable-cli
originals-path /go/src/github.com/photoprism/photoprism/assets/testdata/originals
import-path /srv/photoprism/photos/import
export-path /srv/photoprism/photos/export
cache-path /srv/photoprism/cache
assets-path /go/src/github.com/photoprism/photoprism/assets
database-driver mysql
database-dsn photoprism:photoprism@tcp(database:3306)/photoprism?parseTime=true
`
assert.Equal(t, expected, output)
assert.Nil(t, err)
}