mirror of
https://github.com/LukeHagar/sailpoint-cli.git
synced 2025-12-06 12:47:44 +00:00
36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
// Copyright (c) 2023, SailPoint Technologies, Inc. All rights reserved.
|
|
package connector
|
|
|
|
import (
|
|
"bytes"
|
|
"io"
|
|
"net/http"
|
|
"testing"
|
|
|
|
"github.com/golang/mock/gomock"
|
|
"github.com/sailpoint-oss/sailpoint-cli/internal/mocks"
|
|
)
|
|
|
|
func TestSourceDataDiscoverWithoutInput(t *testing.T) {
|
|
ctrl := gomock.NewController(t)
|
|
defer ctrl.Finish()
|
|
i := `{"connectorRef":"test-connector","tag":"latest","type":"std:source-data:discover","config":{},"input":{"queryInput":{}}}`
|
|
|
|
client := mocks.NewMockClient(ctrl)
|
|
client.EXPECT().
|
|
Post(gomock.Any(), gomock.Any(), "application/json", bytes.NewReader([]byte(i))).
|
|
Return(&http.Response{StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader([]byte("{}")))}, nil)
|
|
|
|
cmd := newConnInvokeSourceDataDiscoverCmd(client)
|
|
addRequiredFlagsFromParentCmd(cmd)
|
|
|
|
b := new(bytes.Buffer)
|
|
cmd.SetOut(b)
|
|
cmd.SetArgs([]string{"-c", "test-connector", "--config-json", "{}"})
|
|
|
|
err := cmd.Execute()
|
|
if err == nil {
|
|
t.Errorf("failed to detect error: reading source data discover")
|
|
}
|
|
}
|