2019-12-17 18:27:48 +01:00
|
|
|
package entity
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNewPhotoKeyword(t *testing.T) {
|
|
|
|
t.Run("new keyword", func(t *testing.T) {
|
|
|
|
m := NewPhotoKeyword(uint(3), uint(8))
|
|
|
|
assert.Equal(t, uint(3), m.PhotoID)
|
|
|
|
assert.Equal(t, uint(8), m.KeywordID)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestPhotoKeyword_TableName(t *testing.T) {
|
|
|
|
photoKeyword := &PhotoKeyword{}
|
|
|
|
tableName := photoKeyword.TableName()
|
|
|
|
|
|
|
|
assert.Equal(t, "photos_keywords", tableName)
|
|
|
|
}
|
2020-05-08 14:18:11 +02:00
|
|
|
|
|
|
|
func TestPhotoKeywords_FirstOrCreate(t *testing.T) {
|
2020-05-10 19:43:49 +02:00
|
|
|
m := PhotoKeywordFixtures["1"]
|
|
|
|
r := m.FirstOrCreate()
|
2020-05-08 14:18:11 +02:00
|
|
|
assert.Equal(t, uint(0xf4244), r.PhotoID)
|
|
|
|
}
|