Files
query-orchestration/api/queryAPI/export_test.go
T

42 lines
870 B
Go
Raw Normal View History

package queryapi_test
2025-01-15 19:45:51 +00:00
import (
"net/http"
"testing"
queryapi "queryorchestration/api/queryAPI"
2025-03-05 12:05:46 +00:00
"github.com/google/uuid"
2025-01-15 19:45:51 +00:00
"github.com/stretchr/testify/assert"
2025-03-19 11:54:14 +00:00
"github.com/stretchr/testify/require"
2025-01-15 19:45:51 +00:00
)
func TestTriggerExport(t *testing.T) {
ctx, rec := createContext(t)
cfg := &ControllerConfig{}
2025-01-15 19:45:51 +00:00
svc := createControllerServices(cfg)
cons := queryapi.NewControllers(svc)
2025-01-15 19:45:51 +00:00
err := cons.TriggerExport(ctx, "clientid")
2025-03-19 11:54:14 +00:00
require.NoError(t, err)
2025-01-15 19:45:51 +00:00
assert.Equal(t, http.StatusOK, rec.Code)
assert.NotEmpty(t, rec.Body.String())
}
func TestExportState(t *testing.T) {
ctx, rec := createContext(t)
cfg := &ControllerConfig{}
svc := createControllerServices(cfg)
cons := queryapi.NewControllers(svc)
id := uuid.New()
err := cons.ExportState(ctx, id)
2025-03-19 11:54:14 +00:00
require.NoError(t, err)
assert.Equal(t, http.StatusOK, rec.Code)
assert.NotEmpty(t, rec.Body.String())
}