photoprism/internal/api/photo_thumbnail_test.go
Michael Mayer 2281c0c675 Backend: Refactor API source structure
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2019-12-16 11:04:49 +01:00

25 lines
596 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.StatusBadRequest, 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.StatusNotFound, result.Code)
})
}