Merged in feature/docresult (pull request #105)
Document Result Endpoint * testing * cleantesting * progress * query * lint * readme * dockerclient * api * passtest * tests * test
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package queryapi_test
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
queryapi "queryorchestration/api/queryAPI"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
"github.com/google/uuid"
|
||||
"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 := queryapi.NewControllers(validator.New(), &queryapi.Services{})
|
||||
|
||||
err := cons.TriggerExport(ctx, "clientid")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, http.StatusOK, rec.Code)
|
||||
assert.NotEmpty(t, rec.Body.String())
|
||||
}
|
||||
|
||||
func TestExportState(t *testing.T) {
|
||||
e := echo.New()
|
||||
req := httptest.NewRequest(http.MethodPost, "/", strings.NewReader(""))
|
||||
rec := httptest.NewRecorder()
|
||||
ctx := e.NewContext(req, rec)
|
||||
|
||||
cons := queryapi.NewControllers(validator.New(), &queryapi.Services{})
|
||||
|
||||
id := uuid.New()
|
||||
|
||||
err := cons.ExportState(ctx, id)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, http.StatusOK, rec.Code)
|
||||
assert.NotEmpty(t, rec.Body.String())
|
||||
}
|
||||
Reference in New Issue
Block a user