Files
query-orchestration/api/queryService/export_test.go
T
Michael McGuinness 6648cdf1cb Merged in feature/clientexternalid (pull request #99)
Client External ID

* normalizeexternalid

* cleanopenapi

* cleanopenapi

* changingpublic

* noprecommit

* testing

* precommit

* processtest

* nodb

* tests

* tests
2025-03-11 16:31:06 +00:00

46 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{})
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 := 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())
}