photoprism/internal/query/camera_test.go
Michael Mayer 582113fed4 Backend: Add write mutex to entities and improve test fixtures #164
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-01-06 04:24:49 +01:00

19 lines
510 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-se", func(t *testing.T) {
camera := entity.NewCamera("iPhone SE", "Apple")
c := config.TestConfig()
camera.FirstOrCreate(c.Db())
assert.Equal(t, uint(2), camera.ID)
})
}