photoprism/internal/photoprism/import_options_test.go
Michael Mayer 323d495840 Auth: Apply user rights and permissions in the search API #98 #782
Signed-off-by: Michael Mayer <michael@photoprism.app>
2022-09-30 00:42:19 +02:00

49 lines
1.6 KiB
Go

package photoprism
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestImportOptionsCopy(t *testing.T) {
t.Run("Default", func(t *testing.T) {
result := ImportOptionsCopy("xxx", "")
assert.Equal(t, "xxx", result.Path)
assert.Equal(t, "", result.DestFolder)
assert.Equal(t, false, result.Move)
assert.Equal(t, false, result.RemoveDotFiles)
assert.Equal(t, false, result.RemoveExistingFiles)
assert.Equal(t, false, result.RemoveEmptyDirectories)
})
t.Run("WithDestPath", func(t *testing.T) {
result := ImportOptionsCopy("xxx", "foo/bar")
assert.Equal(t, "xxx", result.Path)
assert.Equal(t, "foo/bar", result.DestFolder)
assert.Equal(t, false, result.Move)
assert.Equal(t, false, result.RemoveDotFiles)
assert.Equal(t, false, result.RemoveExistingFiles)
assert.Equal(t, false, result.RemoveEmptyDirectories)
})
}
func TestImportOptionsMove(t *testing.T) {
t.Run("Default", func(t *testing.T) {
result := ImportOptionsMove("xxx", "")
assert.Equal(t, "xxx", result.Path)
assert.Equal(t, "", result.DestFolder)
assert.Equal(t, true, result.Move)
assert.Equal(t, true, result.RemoveDotFiles)
assert.Equal(t, true, result.RemoveExistingFiles)
assert.Equal(t, true, result.RemoveEmptyDirectories)
})
t.Run("WithDestPath", func(t *testing.T) {
result := ImportOptionsMove("xxx", "foo/bar")
assert.Equal(t, "xxx", result.Path)
assert.Equal(t, "foo/bar", result.DestFolder)
assert.Equal(t, true, result.Move)
assert.Equal(t, true, result.RemoveDotFiles)
assert.Equal(t, true, result.RemoveExistingFiles)
assert.Equal(t, true, result.RemoveEmptyDirectories)
})
}