photoprism/internal/api/download_album_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

27 lines
642 B
Go

package api
import (
"net/http"
"testing"
"github.com/stretchr/testify/assert"
)
func TestDownloadAlbum(t *testing.T) {
t.Run("download not existing album", func(t *testing.T) {
app, router, conf := NewApiTest()
DownloadAlbum(router)
r := PerformRequest(app, "GET", "/api/v1/albums/5678/dl?t="+conf.DownloadToken())
assert.Equal(t, http.StatusNotFound, r.Code)
})
t.Run("download existing album", func(t *testing.T) {
app, router, conf := NewApiTest()
DownloadAlbum(router)
r := PerformRequest(app, "GET", "/api/v1/albums/as6sg6bxpogaaba8/dl?t="+conf.DownloadToken())
assert.Equal(t, http.StatusOK, r.Code)
})
}