mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
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)
This commit is contained in:
84
pkg/clean/sql_test.go
Normal file
84
pkg/clean/sql_test.go
Normal file
@@ -0,0 +1,84 @@
|
||||
package clean
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestSqlSpecial(t *testing.T) {
|
||||
t.Run("Special", func(t *testing.T) {
|
||||
if s, o := SqlSpecial(1); !s {
|
||||
t.Error("char is special")
|
||||
} else if !o {
|
||||
t.Error("\" must be omitted")
|
||||
}
|
||||
|
||||
if s, o := SqlSpecial(31); !s {
|
||||
t.Error("char is special")
|
||||
} else if !o {
|
||||
t.Error("\" must be omitted")
|
||||
}
|
||||
|
||||
if s, o := SqlSpecial('\\'); !s {
|
||||
t.Error("\\ is special")
|
||||
} else if o {
|
||||
t.Error("\\ must not be omitted")
|
||||
}
|
||||
|
||||
if s, o := SqlSpecial('\''); !s {
|
||||
t.Error("' is special")
|
||||
} else if o {
|
||||
t.Error("' must not be omitted")
|
||||
}
|
||||
|
||||
if s, o := SqlSpecial('"'); !s {
|
||||
t.Error("\" is special")
|
||||
} else if o {
|
||||
t.Error("\" must not be omitted")
|
||||
}
|
||||
})
|
||||
t.Run("NotSpecial", func(t *testing.T) {
|
||||
if s, o := SqlSpecial(32); s {
|
||||
t.Error("space is not special")
|
||||
} else if o {
|
||||
t.Error("space must not be omitted")
|
||||
}
|
||||
|
||||
if s, o := SqlSpecial('A'); s {
|
||||
t.Error("A is not special")
|
||||
} else if o {
|
||||
t.Error("A must not be omitted")
|
||||
}
|
||||
|
||||
if s, o := SqlSpecial('a'); s {
|
||||
t.Error("a is not special")
|
||||
} else if o {
|
||||
t.Error("a must not be omitted")
|
||||
}
|
||||
|
||||
if s, o := SqlSpecial('_'); s {
|
||||
t.Error("_ is not special")
|
||||
} else if o {
|
||||
t.Error("_ must not be omitted")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestSqlString(t *testing.T) {
|
||||
t.Run("Empty", func(t *testing.T) {
|
||||
assert.Equal(t, "", SqlString(""))
|
||||
})
|
||||
t.Run("Special", func(t *testing.T) {
|
||||
s := "' \" \t \n %_''"
|
||||
exp := "'' \"\" %_''''"
|
||||
result := SqlString(s)
|
||||
t.Logf("String..: %s", s)
|
||||
t.Logf("Expected: %s", exp)
|
||||
t.Logf("Result..: %s", result)
|
||||
assert.Equal(t, exp, result)
|
||||
})
|
||||
t.Run("Alnum", func(t *testing.T) {
|
||||
assert.Equal(t, "123ABCabc", SqlString("123ABCabc"))
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user