c78ca26a6f
export * export
48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
package queryservice_test
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"strings"
|
|
"testing"
|
|
|
|
queryservice "queryorchestration/api/queryService"
|
|
|
|
"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 := queryservice.NewControllers(validator.New(), &queryservice.Services{})
|
|
|
|
id := uuid.New()
|
|
|
|
err := cons.TriggerExport(ctx, id)
|
|
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 := queryservice.NewControllers(validator.New(), &queryservice.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())
|
|
}
|