photoprism/internal/api/photo_thumbnail_test.go
Michael Mayer 1c53a565a7 Configure on-demand rendering of regular thumbnail sizes #294
Can be enabled by setting PHOTOPRISM_RESAMPLE_UNCACHED to true

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-05-05 15:42:54 +02:00

32 lines
828 B
Go

package api
import (
"net/http"
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetThumbnail(t *testing.T) {
t.Run("invalid type", func(t *testing.T) {
app, router, ctx := NewApiTest()
GetThumbnail(router, ctx)
result := PerformRequest(app, "GET", "/api/v1/thumbnails/1/xxx")
assert.Equal(t, http.StatusOK, result.Code)
})
t.Run("invalid hash", func(t *testing.T) {
app, router, ctx := NewApiTest()
GetThumbnail(router, ctx)
result := PerformRequest(app, "GET", "/api/v1/thumbnails/1/tile_500")
assert.Equal(t, http.StatusOK, result.Code)
})
t.Run("could not find original", func(t *testing.T) {
app, router, ctx := NewApiTest()
GetThumbnail(router, ctx)
result := PerformRequest(app, "GET", "/api/v1/thumbnails/123xxx/tile_500")
assert.Equal(t, http.StatusOK, result.Code)
})
}