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