photoprism/internal/api/share_preview_test.go

24 lines
570 B
Go
Raw Normal View History

2020-02-03 15:50:46 +01:00
package api
import (
"net/http"
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetPreview(t *testing.T) {
2020-05-13 20:05:33 +02:00
t.Run("not found", func(t *testing.T) {
app, router, _ := NewApiTest()
SharePreview(router)
r := PerformRequest(app, "GET", "/a/1jxf3jfn2k/st9lxuqxpogaaba7/preview")
2020-05-13 20:05:33 +02:00
assert.Equal(t, http.StatusNotFound, r.Code)
2020-02-03 15:50:46 +01:00
})
t.Run("invalid token", func(t *testing.T) {
app, router, _ := NewApiTest()
SharePreview(router)
r := PerformRequest(app, "GET", "/a/xxx/st9lxuqxpogaaba7/preview")
assert.Equal(t, http.StatusNotFound, r.Code)
})
2020-02-03 15:50:46 +01:00
}