2ff6e05ffc
Permit integration - part 1 * WIP permit integration * slim down build * Merge branch 'main' of bitbucket.org:aarete/query-orchestration into feature/permit-integration-1 * omit swagger from auth * clean build * comment * part 1 completed this is the initial permitio parts and tests without integration. Also testing.md since we have a new test target `task test:permitio` * feature flag for no jwt validation * permit integration * fix ci unit tests * ci fix * build fix * fix home handler * fix redirect * test fix * update docs for auth
44 lines
940 B
Go
44 lines
940 B
Go
package queryapi_test
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
|
|
queryapi "queryorchestration/api/queryAPI"
|
|
|
|
"github.com/google/uuid"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestTriggerExport(t *testing.T) {
|
|
ctx, rec := createContext(t)
|
|
cfg := &ControllerConfig{}
|
|
initializeTestConfig(t, cfg)
|
|
|
|
svc := createControllerServices(cfg)
|
|
cons := queryapi.NewControllers(svc, cfg)
|
|
|
|
err := cons.TriggerExport(ctx, "clientid")
|
|
require.NoError(t, err)
|
|
assert.Equal(t, http.StatusOK, rec.Code)
|
|
assert.NotEmpty(t, rec.Body.String())
|
|
}
|
|
|
|
func TestExportState(t *testing.T) {
|
|
ctx, rec := createContext(t)
|
|
|
|
cfg := &ControllerConfig{}
|
|
initializeTestConfig(t, cfg)
|
|
|
|
svc := createControllerServices(cfg)
|
|
cons := queryapi.NewControllers(svc, cfg)
|
|
|
|
id := uuid.New()
|
|
|
|
err := cons.ExportState(ctx, id)
|
|
require.NoError(t, err)
|
|
assert.Equal(t, http.StatusOK, rec.Code)
|
|
assert.NotEmpty(t, rec.Body.String())
|
|
}
|