2021-02-18 14:39:08 +01:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestConfig_DisableBackups(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
assert.False(t, c.DisableBackups())
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestConfig_DisableWebDAV(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
2022-06-25 03:48:05 +02:00
|
|
|
|
|
|
|
c.options.Public = false
|
|
|
|
c.options.ReadOnly = false
|
|
|
|
c.options.Demo = false
|
|
|
|
|
2021-02-18 14:39:08 +01:00
|
|
|
assert.False(t, c.DisableWebDAV())
|
|
|
|
|
2022-06-25 03:48:05 +02:00
|
|
|
c.options.Public = true
|
|
|
|
c.options.ReadOnly = false
|
|
|
|
c.options.Demo = false
|
|
|
|
|
|
|
|
assert.True(t, c.DisableWebDAV())
|
|
|
|
|
|
|
|
c.options.Public = false
|
2021-02-18 14:39:08 +01:00
|
|
|
c.options.ReadOnly = true
|
2022-06-25 03:48:05 +02:00
|
|
|
c.options.Demo = false
|
|
|
|
|
2023-02-09 13:14:56 +01:00
|
|
|
assert.False(t, c.DisableWebDAV())
|
2022-06-25 03:48:05 +02:00
|
|
|
|
|
|
|
c.options.Public = false
|
|
|
|
c.options.ReadOnly = false
|
2021-02-18 14:39:08 +01:00
|
|
|
c.options.Demo = true
|
2022-06-25 03:48:05 +02:00
|
|
|
|
2021-02-18 14:39:08 +01:00
|
|
|
assert.True(t, c.DisableWebDAV())
|
2022-06-25 03:48:05 +02:00
|
|
|
|
|
|
|
c.options.Public = true
|
|
|
|
c.options.ReadOnly = true
|
|
|
|
c.options.Demo = true
|
|
|
|
|
|
|
|
assert.True(t, c.DisableWebDAV())
|
|
|
|
|
|
|
|
c.options.Public = false
|
|
|
|
c.options.ReadOnly = false
|
|
|
|
c.options.Demo = false
|
|
|
|
|
|
|
|
assert.False(t, c.DisableWebDAV())
|
2021-02-18 14:39:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestConfig_DisableExifTool(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
assert.False(t, c.DisableExifTool())
|
|
|
|
|
|
|
|
c.options.ExifToolBin = "XXX"
|
|
|
|
assert.True(t, c.DisableExifTool())
|
|
|
|
}
|
2021-09-24 01:53:42 +02:00
|
|
|
|
2022-10-07 16:45:49 +02:00
|
|
|
func TestConfig_ExifToolEnabled(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
assert.True(t, c.ExifToolEnabled())
|
|
|
|
|
|
|
|
c.options.ExifToolBin = "XXX"
|
|
|
|
assert.False(t, c.ExifToolEnabled())
|
|
|
|
}
|
|
|
|
|
2021-09-24 01:53:42 +02:00
|
|
|
func TestConfig_DisableFaces(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
assert.False(t, c.DisableFaces())
|
|
|
|
c.options.DisableFaces = true
|
|
|
|
assert.True(t, c.DisableFaces())
|
|
|
|
c.options.DisableFaces = false
|
|
|
|
c.options.DisableTensorFlow = true
|
|
|
|
assert.True(t, c.DisableFaces())
|
|
|
|
c.options.DisableTensorFlow = false
|
|
|
|
assert.False(t, c.DisableFaces())
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestConfig_DisableClassification(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
assert.False(t, c.DisableClassification())
|
|
|
|
c.options.DisableClassification = true
|
|
|
|
assert.True(t, c.DisableClassification())
|
|
|
|
c.options.DisableClassification = false
|
|
|
|
c.options.DisableTensorFlow = true
|
|
|
|
assert.True(t, c.DisableClassification())
|
|
|
|
c.options.DisableTensorFlow = false
|
|
|
|
assert.False(t, c.DisableClassification())
|
|
|
|
}
|
2022-04-06 17:46:41 +02:00
|
|
|
|
|
|
|
func TestConfig_DisableDarktable(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
missing := c.DarktableBin() == ""
|
|
|
|
|
|
|
|
assert.Equal(t, missing, c.DisableDarktable())
|
|
|
|
c.options.DisableRaw = true
|
|
|
|
assert.True(t, c.DisableDarktable())
|
|
|
|
c.options.DisableRaw = false
|
|
|
|
assert.Equal(t, missing, c.DisableDarktable())
|
|
|
|
c.options.DisableDarktable = true
|
|
|
|
assert.True(t, c.DisableDarktable())
|
|
|
|
c.options.DisableDarktable = false
|
|
|
|
assert.Equal(t, missing, c.DisableDarktable())
|
|
|
|
}
|
|
|
|
|
2023-02-11 20:18:04 +01:00
|
|
|
func TestConfig_DisableRawTherapee(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
missing := c.RawTherapeeBin() == ""
|
|
|
|
|
|
|
|
assert.Equal(t, missing, c.DisableRawTherapee())
|
|
|
|
c.options.DisableRaw = true
|
|
|
|
assert.True(t, c.DisableRawTherapee())
|
|
|
|
c.options.DisableRaw = false
|
|
|
|
assert.Equal(t, missing, c.DisableRawTherapee())
|
|
|
|
c.options.DisableRawTherapee = true
|
|
|
|
assert.True(t, c.DisableRawTherapee())
|
|
|
|
c.options.DisableRawTherapee = false
|
|
|
|
assert.Equal(t, missing, c.DisableRawTherapee())
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestConfig_DisableImageMagick(t *testing.T) {
|
2022-04-06 17:46:41 +02:00
|
|
|
c := NewConfig(CliTestContext())
|
2023-02-11 20:18:04 +01:00
|
|
|
missing := c.ImageMagickBin() == ""
|
2022-04-06 17:46:41 +02:00
|
|
|
|
2023-02-11 20:18:04 +01:00
|
|
|
assert.Equal(t, missing, c.DisableImageMagick())
|
2022-04-06 17:46:41 +02:00
|
|
|
c.options.DisableRaw = true
|
2023-02-11 20:18:04 +01:00
|
|
|
assert.Equal(t, missing, c.DisableImageMagick())
|
2022-04-06 17:46:41 +02:00
|
|
|
c.options.DisableRaw = false
|
2023-02-11 20:18:04 +01:00
|
|
|
assert.Equal(t, missing, c.DisableImageMagick())
|
|
|
|
c.options.DisableImageMagick = true
|
|
|
|
assert.True(t, c.DisableImageMagick())
|
|
|
|
c.options.DisableImageMagick = false
|
|
|
|
assert.Equal(t, missing, c.DisableImageMagick())
|
2022-04-06 17:46:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestConfig_DisableSips(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
missing := c.SipsBin() == ""
|
|
|
|
|
|
|
|
assert.Equal(t, missing, c.DisableSips())
|
|
|
|
c.options.DisableSips = true
|
|
|
|
assert.True(t, c.DisableSips())
|
|
|
|
c.options.DisableSips = false
|
|
|
|
assert.Equal(t, missing, c.DisableSips())
|
|
|
|
}
|
2023-02-11 20:18:04 +01:00
|
|
|
|
|
|
|
func TestConfig_DisableVector(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
|
|
|
|
assert.Equal(t, c.Sponsor(), !c.DisableVector())
|
|
|
|
c.options.DisableVector = true
|
|
|
|
assert.True(t, c.DisableVector())
|
|
|
|
c.options.DisableVector = false
|
|
|
|
assert.Equal(t, c.Sponsor(), !c.DisableVector())
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestConfig_DisableRaw(t *testing.T) {
|
|
|
|
c := NewConfig(CliTestContext())
|
|
|
|
|
|
|
|
assert.False(t, c.DisableRaw())
|
|
|
|
c.options.DisableRaw = true
|
|
|
|
assert.True(t, c.DisableRaw())
|
|
|
|
assert.True(t, c.DisableDarktable())
|
|
|
|
assert.True(t, c.DisableRawTherapee())
|
|
|
|
c.options.DisableRaw = false
|
|
|
|
assert.False(t, c.DisableRaw())
|
|
|
|
c.options.DisableDarktable = true
|
|
|
|
c.options.DisableRawTherapee = true
|
|
|
|
assert.False(t, c.DisableRaw())
|
|
|
|
c.options.DisableDarktable = false
|
|
|
|
c.options.DisableRawTherapee = false
|
|
|
|
assert.False(t, c.DisableRaw())
|
|
|
|
assert.False(t, c.DisableDarktable())
|
|
|
|
assert.False(t, c.DisableRawTherapee())
|
|
|
|
}
|