2022-04-13 09:48:51 +02:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
|
|
|
"github.com/photoprism/photoprism/internal/config"
|
|
|
|
"github.com/photoprism/photoprism/pkg/capture"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestShowConfigCommand(t *testing.T) {
|
|
|
|
var err error
|
|
|
|
|
|
|
|
ctx := config.CliTestContext()
|
|
|
|
|
|
|
|
output := capture.Output(func() {
|
|
|
|
err = ShowConfigCommand.Run(ctx)
|
|
|
|
})
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2022-04-14 12:30:47 +02:00
|
|
|
// Check the command output for plausibility.
|
2022-04-13 22:17:59 +02:00
|
|
|
assert.Contains(t, output, "config-path")
|
2022-04-13 09:48:51 +02:00
|
|
|
assert.Contains(t, output, "originals-path")
|
|
|
|
assert.Contains(t, output, "import-path")
|
2022-09-30 00:42:19 +02:00
|
|
|
assert.Contains(t, output, "import-dest")
|
2022-04-13 09:48:51 +02:00
|
|
|
assert.Contains(t, output, "cache-path")
|
|
|
|
assert.Contains(t, output, "assets-path")
|
2022-04-13 22:17:59 +02:00
|
|
|
assert.Contains(t, output, "darktable-cli")
|
2022-04-13 09:48:51 +02:00
|
|
|
}
|
|
|
|
|
2022-04-14 12:30:47 +02:00
|
|
|
func TestShowTagsCommand(t *testing.T) {
|
|
|
|
var err error
|
|
|
|
|
|
|
|
ctx := config.CliTestContext()
|
|
|
|
|
|
|
|
output := capture.Output(func() {
|
|
|
|
err = ShowTagsCommand.Run(ctx)
|
|
|
|
})
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check the command output for plausibility.
|
|
|
|
assert.Contains(t, output, "Exiftool")
|
|
|
|
assert.Contains(t, output, "Adobe XMP")
|
|
|
|
assert.Contains(t, output, "Dublin Core")
|
|
|
|
assert.Contains(t, output, "Title")
|
|
|
|
assert.Contains(t, output, "Description")
|
|
|
|
}
|
|
|
|
|
2022-04-13 09:48:51 +02:00
|
|
|
func TestShowFiltersCommand(t *testing.T) {
|
|
|
|
var err error
|
|
|
|
|
|
|
|
ctx := config.CliTestContext()
|
|
|
|
|
|
|
|
output := capture.Output(func() {
|
|
|
|
err = ShowFiltersCommand.Run(ctx)
|
|
|
|
})
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2022-04-14 12:30:47 +02:00
|
|
|
// Check the command output for plausibility.
|
2022-04-13 09:48:51 +02:00
|
|
|
assert.Contains(t, output, "landscape")
|
|
|
|
assert.Contains(t, output, "live")
|
|
|
|
assert.Contains(t, output, "Examples")
|
|
|
|
assert.Contains(t, output, "Filter")
|
|
|
|
assert.Contains(t, output, "Notes")
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestShowFormatsCommand(t *testing.T) {
|
|
|
|
var err error
|
|
|
|
|
|
|
|
ctx := config.CliTestContext()
|
|
|
|
|
|
|
|
output := capture.Output(func() {
|
|
|
|
err = ShowFormatsCommand.Run(ctx)
|
|
|
|
})
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2022-04-14 12:30:47 +02:00
|
|
|
// Check the command output for plausibility.
|
2022-04-13 09:48:51 +02:00
|
|
|
assert.Contains(t, output, "JPEG")
|
|
|
|
assert.Contains(t, output, "MP4")
|
|
|
|
assert.Contains(t, output, "Image")
|
|
|
|
assert.Contains(t, output, "Format")
|
|
|
|
assert.Contains(t, output, "Description")
|
|
|
|
}
|