1c53a565a7
Can be enabled by setting PHOTOPRISM_RESAMPLE_UNCACHED to true Signed-off-by: Michael Mayer <michael@liquidbytes.net>
32 lines
828 B
Go
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)
|
|
})
|
|
}
|