photoprism/internal/config/client_config_test.go
Michael Mayer 92e6c4fe1e Download: Add Disabled, Originals, MediaRaw & MediaSidecar Flags #2234
Extends DownloadSettings with 4 additional options:
- Name: File name pattern for downloaded files (existed)
- Disabled: Disables downloads
- Originals: Only download files stored in "originals" folder
- MediaRaw: Include RAW image files
- MediaSidecar: Include metadata sidecar files (JSON, XMP, YAML)
2022-04-15 09:42:07 +02:00

40 lines
1 KiB
Go

package config
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestConfig_PublicConfig(t *testing.T) {
config := TestConfig()
result := config.PublicConfig()
assert.IsType(t, ClientConfig{}, result)
assert.Equal(t, true, result.Public)
c2 := NewTestErrorConfig()
result2 := c2.PublicConfig()
assert.IsType(t, ClientConfig{}, result2)
assert.Equal(t, false, result2.Public)
}
func TestConfig_GuestConfig(t *testing.T) {
config := TestConfig()
result := config.GuestConfig()
assert.IsType(t, ClientConfig{}, result)
assert.Equal(t, true, result.Public)
assert.Equal(t, false, result.Experimental)
assert.Equal(t, true, result.ReadOnly)
}
func TestConfig_Flags(t *testing.T) {
config := TestConfig()
config.options.Experimental = true
config.options.ReadOnly = true
config.settings.UI.Scrollbar = false
result := config.Flags()
assert.Equal(t, []string{"public", "debug", "test", "sponsor", "experimental", "readonly", "settings", "hide-scrollbar"}, result)
config.options.Experimental = false
config.options.ReadOnly = false
}