Tests: Add unit tests
This commit is contained in:
parent
74f6954a90
commit
e1364f288c
2 changed files with 51 additions and 0 deletions
26
internal/commands/show_config_options_test.go
Normal file
26
internal/commands/show_config_options_test.go
Normal file
|
@ -0,0 +1,26 @@
|
|||
package commands
|
||||
|
||||
import (
|
||||
"github.com/photoprism/photoprism/internal/config"
|
||||
"github.com/photoprism/photoprism/pkg/capture"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestShowConfigOptionsCommand(t *testing.T) {
|
||||
var err error
|
||||
|
||||
ctx := config.CliTestContext()
|
||||
|
||||
output := capture.Output(func() {
|
||||
err = ShowConfigOptionsCommand.Run(ctx)
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
assert.Contains(t, output, "PHOTOPRISM_IMPORT_PATH")
|
||||
assert.Contains(t, output, "--sidecar-path")
|
||||
assert.Contains(t, output, "sidecar `PATH` *optional*")
|
||||
}
|
25
internal/commands/show_config_yaml_test.go
Normal file
25
internal/commands/show_config_yaml_test.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
package commands
|
||||
|
||||
import (
|
||||
"github.com/photoprism/photoprism/internal/config"
|
||||
"github.com/photoprism/photoprism/pkg/capture"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestShowConfigYamlCommand(t *testing.T) {
|
||||
var err error
|
||||
|
||||
ctx := config.CliTestContext()
|
||||
|
||||
output := capture.Output(func() {
|
||||
err = ShowConfigYamlCommand.Run(ctx)
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
assert.Contains(t, output, "ImportPath")
|
||||
assert.Contains(t, output, "--sidecar-path")
|
||||
}
|
Loading…
Reference in a new issue