28 lines
666 B
Go
28 lines
666 B
Go
|
|
package queryservice_test
|
||
|
|
|
||
|
|
import (
|
||
|
|
"net/http"
|
||
|
|
"net/http/httptest"
|
||
|
|
queryservice "queryorchestration/api/queryService"
|
||
|
|
"strings"
|
||
|
|
"testing"
|
||
|
|
|
||
|
|
"github.com/go-playground/validator/v10"
|
||
|
|
"github.com/labstack/echo/v4"
|
||
|
|
"github.com/stretchr/testify/assert"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestTriggerExport(t *testing.T) {
|
||
|
|
e := echo.New()
|
||
|
|
req := httptest.NewRequest(http.MethodPost, "/", strings.NewReader(""))
|
||
|
|
rec := httptest.NewRecorder()
|
||
|
|
ctx := e.NewContext(req, rec)
|
||
|
|
|
||
|
|
cons := queryservice.NewControllers(validator.New(), &queryservice.Services{})
|
||
|
|
|
||
|
|
err := cons.TriggerExport(ctx)
|
||
|
|
assert.Nil(t, err)
|
||
|
|
assert.Equal(t, http.StatusOK, rec.Code)
|
||
|
|
assert.NotEmpty(t, rec.Body.String())
|
||
|
|
}
|