photoprism/internal/api/index_test.go

20 lines
460 B
Go
Raw Normal View History

2020-05-14 18:10:01 +02:00
package api
import (
"github.com/stretchr/testify/assert"
"github.com/tidwall/gjson"
"net/http"
"testing"
)
func TestCancelIndex(t *testing.T) {
t.Run("successful request", func(t *testing.T) {
app, router, _ := NewApiTest()
CancelIndexing(router)
2020-05-14 18:10:01 +02:00
r := PerformRequest(app, "DELETE", "/api/v1/index")
val := gjson.Get(r.Body.String(), "message")
assert.Equal(t, "indexing canceled", val.String())
assert.Equal(t, http.StatusOK, r.Code)
})
}