photoprism/internal/entity/photo_album_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

37 lines
1.1 KiB
Go

package entity
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestPhotoAlbumMap_Get(t *testing.T) {
t.Run("get existing photoalbum", func(t *testing.T) {
r := PhotoAlbumFixtures.Get("1", "", "")
assert.Equal(t, "as6sg6bxpogaaba8", r.AlbumUID)
assert.Equal(t, "ps6sg6be2lvl0yh7", r.PhotoUID)
assert.IsType(t, PhotoAlbum{}, r)
})
t.Run("get not existing photoalbum", func(t *testing.T) {
r := PhotoAlbumFixtures.Get("x", "1234", "5678")
assert.Equal(t, "5678", r.AlbumUID)
assert.Equal(t, "1234", r.PhotoUID)
assert.IsType(t, PhotoAlbum{}, r)
})
}
func TestPhotoAlbumMap_Pointer(t *testing.T) {
t.Run("get existing photoalbum pointer", func(t *testing.T) {
r := PhotoAlbumFixtures.Pointer("1", "", "")
assert.Equal(t, "as6sg6bxpogaaba8", r.AlbumUID)
assert.Equal(t, "ps6sg6be2lvl0yh7", r.PhotoUID)
assert.IsType(t, &PhotoAlbum{}, r)
})
t.Run("get not existing photoalbum pointer", func(t *testing.T) {
r := PhotoAlbumFixtures.Pointer("xy", "xxx", "yyy")
assert.Equal(t, "yyy", r.AlbumUID)
assert.Equal(t, "xxx", r.PhotoUID)
assert.IsType(t, &PhotoAlbum{}, r)
})
}