photoprism/internal/entity/password_fixtures_test.go

34 lines
853 B
Go
Raw Normal View History

2021-08-26 18:02:53 +02:00
package entity
import (
"testing"
2021-08-28 13:55:37 +02:00
"github.com/stretchr/testify/assert"
2021-08-26 18:02:53 +02:00
)
func TestPasswordMap_Get(t *testing.T) {
t.Run("get existing password", func(t *testing.T) {
r := PasswordFixtures.Get("alice")
assert.Equal(t, "uqxetse3cy5eo9z2", r.UID)
assert.IsType(t, Password{}, r)
})
t.Run("get not existing password", func(t *testing.T) {
r := PasswordFixtures.Get("monstera")
assert.Equal(t, "", r.UID)
assert.IsType(t, Password{}, r)
})
}
func TestPasswordMap_Pointer(t *testing.T) {
t.Run("get existing password", func(t *testing.T) {
r := PasswordFixtures.Pointer("alice")
assert.Equal(t, "uqxetse3cy5eo9z2", r.UID)
assert.IsType(t, &Password{}, r)
})
t.Run("get not existing password", func(t *testing.T) {
r := PasswordFixtures.Pointer("monstera")
assert.Equal(t, "", r.UID)
assert.IsType(t, &Password{}, r)
})
}