photoprism/internal/entity/auth_user_share_fixtures_test.go
Michael Mayer 713593da4e Auth: Add CLI command to create access tokens for apps #782 #808 #3943
You can now run "photoprism auth add" to create new client access tokens
that allow external applications to use the built-in REST API.

Signed-off-by: Michael Mayer <michael@photoprism.app>
2024-01-05 16:31:07 +01:00

41 lines
1.0 KiB
Go

package entity
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestUserShareMap_Get(t *testing.T) {
t.Run("AliceAlbum", func(t *testing.T) {
r := UserShareFixtures.Get("AliceAlbum")
assert.Equal(t, "The quick brown fox jumps over the lazy dog.", r.Comment)
assert.Equal(t, "as6sg6bxpogaaba9", r.ShareUID)
assert.IsType(t, UserShare{}, r)
})
t.Run("Invalid", func(t *testing.T) {
r := UserShareFixtures.Get("monstera")
assert.Equal(t, "", r.Comment)
assert.Equal(t, "", r.ShareUID)
assert.IsType(t, UserShare{}, r)
})
}
func TestUserShareMap_Pointer(t *testing.T) {
t.Run("AliceAlbum", func(t *testing.T) {
r := UserShareFixtures.Pointer("AliceAlbum")
assert.Equal(t, "The quick brown fox jumps over the lazy dog.", r.Comment)
assert.Equal(t, "as6sg6bxpogaaba9", r.ShareUID)
assert.IsType(t, &UserShare{}, r)
})
t.Run("Invalid", func(t *testing.T) {
r := UserShareFixtures.Pointer("monstera")
assert.Equal(t, "", r.Comment)
assert.Equal(t, "", r.ShareUID)
assert.IsType(t, &UserShare{}, r)
})
}