photoprism/internal/query/camera_test.go
Michael Mayer 01ca94d536 Backend: Initialize test db with fixtures #84 #129
Fixtures can be found in assets/resources/examples/fixtures.sql and must be maintained manually for now

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-01-06 02:14:17 +01:00

20 lines
524 B
Go

package query
import (
"testing"
"github.com/photoprism/photoprism/internal/config"
"github.com/photoprism/photoprism/internal/entity"
"github.com/stretchr/testify/assert"
)
// Example for using database fixtures defined in assets/resources/examples/fixtures.sql
func TestCamera_FirstOrCreate(t *testing.T) {
t.Run("iphone_5", func(t *testing.T) {
camera := entity.NewCamera("iPhone 5", "Apple")
c := config.TestConfig()
camera.FirstOrCreate(c.Db())
assert.Equal(t, "TEST FIXTURE", camera.CameraNotes)
})
}