2020-01-06 02:14:17 +01:00
|
|
|
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) {
|
2020-01-06 04:24:49 +01:00
|
|
|
t.Run("iphone-se", func(t *testing.T) {
|
|
|
|
camera := entity.NewCamera("iPhone SE", "Apple")
|
2020-01-06 02:14:17 +01:00
|
|
|
c := config.TestConfig()
|
|
|
|
camera.FirstOrCreate(c.Db())
|
2020-02-07 17:02:53 +01:00
|
|
|
assert.GreaterOrEqual(t, camera.ID, uint(1))
|
2020-01-06 02:14:17 +01:00
|
|
|
})
|
|
|
|
}
|