photoprism/internal/workers/sync_download_test.go
Michael Mayer e3bb8b19dd Routing: Prefix frontend UI routes with /library #840 #2466
Also improves migrations and updates the db schema docs.

Signed-off-by: Michael Mayer <michael@photoprism.app>
2022-10-15 21:54:11 +02:00

50 lines
1 KiB
Go

package workers
import (
"strings"
"testing"
"github.com/photoprism/photoprism/internal/entity"
"github.com/photoprism/photoprism/internal/config"
"github.com/stretchr/testify/assert"
)
func TestSync_download(t *testing.T) {
conf := config.TestConfig()
t.Logf("database-dsn: %s", conf.DatabaseDsn())
worker := NewSync(conf)
assert.IsType(t, &Sync{}, worker)
account := entity.ServiceFixtureWebdavDummy
if _, err := worker.download(account); err != nil {
t.Fatal(err)
}
}
func TestSync_downloadPath(t *testing.T) {
conf := config.TestConfig()
worker := NewSync(conf)
assert.IsType(t, &Sync{}, worker)
assert.True(t, strings.HasSuffix(worker.downloadPath(), "testdata/temp/sync"))
}
func TestSync_relatedDownloads(t *testing.T) {
conf := config.TestConfig()
worker := NewSync(conf)
account := entity.ServiceFixtureWebdavDummy
assert.IsType(t, &Sync{}, worker)
if result, err := worker.relatedDownloads(account); err != nil {
t.Fatal(err)
} else {
assert.IsType(t, Downloads{}, result)
}
}