Tests: Add tests for internal/photoprism
This commit is contained in:
parent
59512b0e50
commit
10983e73d4
2 changed files with 38 additions and 0 deletions
|
@ -46,6 +46,31 @@ func TestMediaFile_HasSidecarJson(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestMediaFile_SidecarJsonName(t *testing.T) {
|
||||
t.Run("false", func(t *testing.T) {
|
||||
conf := config.TestConfig()
|
||||
|
||||
mediaFile, err := NewMediaFile(conf.ExamplesPath() + "/beach_sand.jpg")
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
assert.Equal(t, "", mediaFile.SidecarJsonName())
|
||||
})
|
||||
t.Run("true", func(t *testing.T) {
|
||||
conf := config.TestConfig()
|
||||
|
||||
mediaFile, err := NewMediaFile(conf.ExamplesPath() + "/blue-go-video.mp4")
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
assert.Contains(t, mediaFile.SidecarJsonName(), "blue-go-video.mp4.json")
|
||||
})
|
||||
}
|
||||
|
||||
func TestMediaFile_NeedsExifToolJson(t *testing.T) {
|
||||
t.Run("false", func(t *testing.T) {
|
||||
conf := config.TestConfig()
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package photoprism
|
||||
|
||||
import (
|
||||
"github.com/photoprism/photoprism/pkg/s2"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestPhotos_Init(t *testing.T) {
|
||||
|
@ -11,3 +14,13 @@ func TestPhotos_Init(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPhotos_Find(t *testing.T) {
|
||||
photos := NewPhotos()
|
||||
if err := photos.Init(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
r := photos.Find(time.Date(2020, 11, 11, 9, 7, 18, 0, time.UTC), s2.TokenPrefix+"85d1ea7d382")
|
||||
assert.Equal(t, uint(0), r)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue