2020-05-12 11:52:09 +00:00
|
|
|
package entity
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2020-11-21 17:08:41 +00:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2020-05-12 11:52:09 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestPhotoMap_Get(t *testing.T) {
|
|
|
|
t.Run("get existing photo", func(t *testing.T) {
|
|
|
|
r := PhotoFixtures.Get("19800101_000002_D640C559")
|
2020-05-23 18:58:58 +00:00
|
|
|
assert.Equal(t, "pt9jtdre2lvl0yh7", r.PhotoUID)
|
2021-08-05 10:33:52 +00:00
|
|
|
assert.Equal(t, "27900704_070228_D6D51B6C", r.PhotoName)
|
2020-05-12 11:52:09 +00:00
|
|
|
assert.IsType(t, Photo{}, r)
|
|
|
|
})
|
|
|
|
t.Run("get not existing photo", func(t *testing.T) {
|
|
|
|
r := PhotoFixtures.Get("TestName")
|
|
|
|
assert.Equal(t, "TestName", r.PhotoName)
|
|
|
|
assert.IsType(t, Photo{}, r)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestPhotoMap_Pointer(t *testing.T) {
|
|
|
|
t.Run("get existing photo pointer", func(t *testing.T) {
|
|
|
|
r := PhotoFixtures.Pointer("19800101_000002_D640C559")
|
2020-05-23 18:58:58 +00:00
|
|
|
assert.Equal(t, "pt9jtdre2lvl0yh7", r.PhotoUID)
|
2021-08-05 10:33:52 +00:00
|
|
|
assert.Equal(t, "27900704_070228_D6D51B6C", r.PhotoName)
|
2020-05-12 11:52:09 +00:00
|
|
|
assert.IsType(t, &Photo{}, r)
|
|
|
|
})
|
|
|
|
t.Run("get not existing photo pointer", func(t *testing.T) {
|
|
|
|
r := PhotoFixtures.Pointer("TestName2")
|
|
|
|
assert.Equal(t, "TestName2", r.PhotoName)
|
|
|
|
assert.IsType(t, &Photo{}, r)
|
|
|
|
})
|
|
|
|
}
|