photoprism/internal/entity/user_fixtures_test.go
2021-08-26 18:02:53 +02:00

32 lines
794 B
Go

package entity
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestUserMap_Get(t *testing.T) {
t.Run("get existing user", func(t *testing.T) {
r := UserFixtures.Get("alice")
assert.Equal(t, "alice", r.UserName)
assert.IsType(t, User{}, r)
})
t.Run("get not existing user", func(t *testing.T) {
r := UserFixtures.Get("monstera")
assert.Equal(t, "", r.UserName)
assert.IsType(t, User{}, r)
})
}
func TestUserMap_Pointer(t *testing.T) {
t.Run("get existing user", func(t *testing.T) {
r := UserFixtures.Pointer("alice")
assert.Equal(t, "alice", r.UserName)
assert.IsType(t, &User{}, r)
})
t.Run("get not existing user", func(t *testing.T) {
r := UserFixtures.Pointer("monstera")
assert.Equal(t, "", r.UserName)
assert.IsType(t, &User{}, r)
})
}