2024-02-15 05:39:10 +00:00
|
|
|
//go:build integration
|
|
|
|
|
2024-04-09 17:21:21 +00:00
|
|
|
package action_test
|
2024-02-15 05:39:10 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/muhlemmer/gu"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"google.golang.org/protobuf/types/known/durationpb"
|
|
|
|
"google.golang.org/protobuf/types/known/timestamppb"
|
|
|
|
|
2024-05-04 09:55:57 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/domain"
|
2024-02-15 05:39:10 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/integration"
|
2024-04-09 17:21:21 +00:00
|
|
|
action "github.com/zitadel/zitadel/pkg/grpc/action/v3alpha"
|
2024-02-15 05:39:10 +00:00
|
|
|
object "github.com/zitadel/zitadel/pkg/grpc/object/v2beta"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestServer_CreateTarget(t *testing.T) {
|
2024-04-09 17:21:21 +00:00
|
|
|
ensureFeatureEnabled(t)
|
2024-02-15 05:39:10 +00:00
|
|
|
tests := []struct {
|
|
|
|
name string
|
|
|
|
ctx context.Context
|
2024-04-09 17:21:21 +00:00
|
|
|
req *action.CreateTargetRequest
|
|
|
|
want *action.CreateTargetResponse
|
2024-02-15 05:39:10 +00:00
|
|
|
wantErr bool
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "missing permission",
|
|
|
|
ctx: Tester.WithAuthorization(context.Background(), integration.OrgOwner),
|
2024-04-09 17:21:21 +00:00
|
|
|
req: &action.CreateTargetRequest{
|
2024-02-15 05:39:10 +00:00
|
|
|
Name: fmt.Sprint(time.Now().UnixNano() + 1),
|
|
|
|
},
|
|
|
|
wantErr: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "empty name",
|
|
|
|
ctx: CTX,
|
2024-04-09 17:21:21 +00:00
|
|
|
req: &action.CreateTargetRequest{
|
2024-02-15 05:39:10 +00:00
|
|
|
Name: "",
|
|
|
|
},
|
|
|
|
wantErr: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "empty type",
|
|
|
|
ctx: CTX,
|
2024-04-09 17:21:21 +00:00
|
|
|
req: &action.CreateTargetRequest{
|
2024-02-15 05:39:10 +00:00
|
|
|
Name: fmt.Sprint(time.Now().UnixNano() + 1),
|
|
|
|
TargetType: nil,
|
|
|
|
},
|
|
|
|
wantErr: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "empty webhook url",
|
|
|
|
ctx: CTX,
|
2024-04-09 17:21:21 +00:00
|
|
|
req: &action.CreateTargetRequest{
|
2024-02-15 05:39:10 +00:00
|
|
|
Name: fmt.Sprint(time.Now().UnixNano() + 1),
|
2024-04-09 17:21:21 +00:00
|
|
|
TargetType: &action.CreateTargetRequest_RestWebhook{
|
|
|
|
RestWebhook: &action.SetRESTWebhook{},
|
2024-02-15 05:39:10 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
wantErr: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "empty request response url",
|
|
|
|
ctx: CTX,
|
2024-04-09 17:21:21 +00:00
|
|
|
req: &action.CreateTargetRequest{
|
2024-02-15 05:39:10 +00:00
|
|
|
Name: fmt.Sprint(time.Now().UnixNano() + 1),
|
2024-05-04 09:55:57 +00:00
|
|
|
TargetType: &action.CreateTargetRequest_RestCall{
|
|
|
|
RestCall: &action.SetRESTCall{},
|
2024-02-15 05:39:10 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
wantErr: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "empty timeout",
|
|
|
|
ctx: CTX,
|
2024-04-09 17:21:21 +00:00
|
|
|
req: &action.CreateTargetRequest{
|
2024-05-04 09:55:57 +00:00
|
|
|
Name: fmt.Sprint(time.Now().UnixNano() + 1),
|
|
|
|
Endpoint: "https://example.com",
|
2024-04-09 17:21:21 +00:00
|
|
|
TargetType: &action.CreateTargetRequest_RestWebhook{
|
2024-05-04 09:55:57 +00:00
|
|
|
RestWebhook: &action.SetRESTWebhook{},
|
2024-02-15 05:39:10 +00:00
|
|
|
},
|
2024-05-04 09:55:57 +00:00
|
|
|
Timeout: nil,
|
2024-02-15 05:39:10 +00:00
|
|
|
},
|
|
|
|
wantErr: true,
|
|
|
|
},
|
|
|
|
{
|
2024-05-04 09:55:57 +00:00
|
|
|
name: "async, ok",
|
2024-02-15 05:39:10 +00:00
|
|
|
ctx: CTX,
|
2024-04-09 17:21:21 +00:00
|
|
|
req: &action.CreateTargetRequest{
|
2024-05-04 09:55:57 +00:00
|
|
|
Name: fmt.Sprint(time.Now().UnixNano() + 1),
|
|
|
|
Endpoint: "https://example.com",
|
|
|
|
TargetType: &action.CreateTargetRequest_RestAsync{
|
|
|
|
RestAsync: &action.SetRESTAsync{},
|
|
|
|
},
|
|
|
|
Timeout: durationpb.New(10 * time.Second),
|
|
|
|
},
|
|
|
|
want: &action.CreateTargetResponse{
|
|
|
|
Details: &object.Details{
|
|
|
|
ChangeDate: timestamppb.Now(),
|
|
|
|
ResourceOwner: Tester.Instance.InstanceID(),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "webhook, ok",
|
|
|
|
ctx: CTX,
|
|
|
|
req: &action.CreateTargetRequest{
|
|
|
|
Name: fmt.Sprint(time.Now().UnixNano() + 1),
|
|
|
|
Endpoint: "https://example.com",
|
2024-04-09 17:21:21 +00:00
|
|
|
TargetType: &action.CreateTargetRequest_RestWebhook{
|
|
|
|
RestWebhook: &action.SetRESTWebhook{
|
2024-05-04 09:55:57 +00:00
|
|
|
InterruptOnError: false,
|
2024-02-15 05:39:10 +00:00
|
|
|
},
|
|
|
|
},
|
2024-05-04 09:55:57 +00:00
|
|
|
Timeout: durationpb.New(10 * time.Second),
|
2024-02-15 05:39:10 +00:00
|
|
|
},
|
2024-04-09 17:21:21 +00:00
|
|
|
want: &action.CreateTargetResponse{
|
2024-02-15 05:39:10 +00:00
|
|
|
Details: &object.Details{
|
|
|
|
ChangeDate: timestamppb.Now(),
|
|
|
|
ResourceOwner: Tester.Instance.InstanceID(),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2024-05-04 09:55:57 +00:00
|
|
|
name: "webhook, interrupt on error, ok",
|
2024-02-15 05:39:10 +00:00
|
|
|
ctx: CTX,
|
2024-04-09 17:21:21 +00:00
|
|
|
req: &action.CreateTargetRequest{
|
2024-05-04 09:55:57 +00:00
|
|
|
Name: fmt.Sprint(time.Now().UnixNano() + 1),
|
|
|
|
Endpoint: "https://example.com",
|
2024-04-09 17:21:21 +00:00
|
|
|
TargetType: &action.CreateTargetRequest_RestWebhook{
|
|
|
|
RestWebhook: &action.SetRESTWebhook{
|
2024-05-04 09:55:57 +00:00
|
|
|
InterruptOnError: true,
|
2024-02-15 05:39:10 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
Timeout: durationpb.New(10 * time.Second),
|
|
|
|
},
|
2024-04-09 17:21:21 +00:00
|
|
|
want: &action.CreateTargetResponse{
|
2024-02-15 05:39:10 +00:00
|
|
|
Details: &object.Details{
|
|
|
|
ChangeDate: timestamppb.Now(),
|
|
|
|
ResourceOwner: Tester.Instance.InstanceID(),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2024-05-04 09:55:57 +00:00
|
|
|
name: "call, ok",
|
2024-02-15 05:39:10 +00:00
|
|
|
ctx: CTX,
|
2024-04-09 17:21:21 +00:00
|
|
|
req: &action.CreateTargetRequest{
|
2024-05-04 09:55:57 +00:00
|
|
|
Name: fmt.Sprint(time.Now().UnixNano() + 1),
|
|
|
|
Endpoint: "https://example.com",
|
|
|
|
TargetType: &action.CreateTargetRequest_RestCall{
|
|
|
|
RestCall: &action.SetRESTCall{
|
|
|
|
InterruptOnError: false,
|
2024-02-15 05:39:10 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
Timeout: durationpb.New(10 * time.Second),
|
2024-05-04 09:55:57 +00:00
|
|
|
},
|
|
|
|
want: &action.CreateTargetResponse{
|
|
|
|
Details: &object.Details{
|
|
|
|
ChangeDate: timestamppb.Now(),
|
|
|
|
ResourceOwner: Tester.Instance.InstanceID(),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: "call, interruptOnError, ok",
|
|
|
|
ctx: CTX,
|
|
|
|
req: &action.CreateTargetRequest{
|
|
|
|
Name: fmt.Sprint(time.Now().UnixNano() + 1),
|
|
|
|
Endpoint: "https://example.com",
|
|
|
|
TargetType: &action.CreateTargetRequest_RestCall{
|
|
|
|
RestCall: &action.SetRESTCall{
|
|
|
|
InterruptOnError: true,
|
|
|
|
},
|
2024-02-15 05:39:10 +00:00
|
|
|
},
|
2024-05-04 09:55:57 +00:00
|
|
|
Timeout: durationpb.New(10 * time.Second),
|
2024-02-15 05:39:10 +00:00
|
|
|
},
|
2024-04-09 17:21:21 +00:00
|
|
|
want: &action.CreateTargetResponse{
|
2024-02-15 05:39:10 +00:00
|
|
|
Details: &object.Details{
|
|
|
|
ChangeDate: timestamppb.Now(),
|
|
|
|
ResourceOwner: Tester.Instance.InstanceID(),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
|
|
got, err := Client.CreateTarget(tt.ctx, tt.req)
|
|
|
|
if tt.wantErr {
|
|
|
|
require.Error(t, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
integration.AssertDetails(t, tt.want, got)
|
|
|
|
assert.NotEmpty(t, got.GetId())
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestServer_UpdateTarget(t *testing.T) {
|
2024-04-09 17:21:21 +00:00
|
|
|
ensureFeatureEnabled(t)
|
2024-02-15 05:39:10 +00:00
|
|
|
type args struct {
|
|
|
|
ctx context.Context
|
2024-04-09 17:21:21 +00:00
|
|
|
req *action.UpdateTargetRequest
|
2024-02-15 05:39:10 +00:00
|
|
|
}
|
|
|
|
tests := []struct {
|
|
|
|
name string
|
2024-04-09 17:21:21 +00:00
|
|
|
prepare func(request *action.UpdateTargetRequest) error
|
2024-02-15 05:39:10 +00:00
|
|
|
args args
|
2024-04-09 17:21:21 +00:00
|
|
|
want *action.UpdateTargetResponse
|
2024-02-15 05:39:10 +00:00
|
|
|
wantErr bool
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "missing permission",
|
2024-04-09 17:21:21 +00:00
|
|
|
prepare: func(request *action.UpdateTargetRequest) error {
|
2024-05-04 09:55:57 +00:00
|
|
|
targetID := Tester.CreateTarget(CTX, t, "", "https://example.com", domain.TargetTypeWebhook, false).GetId()
|
2024-02-15 05:39:10 +00:00
|
|
|
request.TargetId = targetID
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: Tester.WithAuthorization(context.Background(), integration.OrgOwner),
|
2024-04-09 17:21:21 +00:00
|
|
|
req: &action.UpdateTargetRequest{
|
2024-02-15 05:39:10 +00:00
|
|
|
Name: gu.Ptr(fmt.Sprint(time.Now().UnixNano() + 1)),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
wantErr: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "not existing",
|
2024-04-09 17:21:21 +00:00
|
|
|
prepare: func(request *action.UpdateTargetRequest) error {
|
2024-02-15 05:39:10 +00:00
|
|
|
request.TargetId = "notexisting"
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: CTX,
|
2024-04-09 17:21:21 +00:00
|
|
|
req: &action.UpdateTargetRequest{
|
2024-02-15 05:39:10 +00:00
|
|
|
Name: gu.Ptr(fmt.Sprint(time.Now().UnixNano() + 1)),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
wantErr: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "change name, ok",
|
2024-04-09 17:21:21 +00:00
|
|
|
prepare: func(request *action.UpdateTargetRequest) error {
|
2024-05-04 09:55:57 +00:00
|
|
|
targetID := Tester.CreateTarget(CTX, t, "", "https://example.com", domain.TargetTypeWebhook, false).GetId()
|
2024-02-15 05:39:10 +00:00
|
|
|
request.TargetId = targetID
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: CTX,
|
2024-04-09 17:21:21 +00:00
|
|
|
req: &action.UpdateTargetRequest{
|
2024-02-15 05:39:10 +00:00
|
|
|
Name: gu.Ptr(fmt.Sprint(time.Now().UnixNano() + 1)),
|
|
|
|
},
|
|
|
|
},
|
2024-04-09 17:21:21 +00:00
|
|
|
want: &action.UpdateTargetResponse{
|
2024-02-15 05:39:10 +00:00
|
|
|
Details: &object.Details{
|
|
|
|
ChangeDate: timestamppb.Now(),
|
|
|
|
ResourceOwner: Tester.Instance.InstanceID(),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "change type, ok",
|
2024-04-09 17:21:21 +00:00
|
|
|
prepare: func(request *action.UpdateTargetRequest) error {
|
2024-05-04 09:55:57 +00:00
|
|
|
targetID := Tester.CreateTarget(CTX, t, "", "https://example.com", domain.TargetTypeWebhook, false).GetId()
|
2024-02-15 05:39:10 +00:00
|
|
|
request.TargetId = targetID
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: CTX,
|
2024-04-09 17:21:21 +00:00
|
|
|
req: &action.UpdateTargetRequest{
|
2024-05-04 09:55:57 +00:00
|
|
|
TargetType: &action.UpdateTargetRequest_RestCall{
|
|
|
|
RestCall: &action.SetRESTCall{
|
|
|
|
InterruptOnError: true,
|
2024-02-15 05:39:10 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-04-09 17:21:21 +00:00
|
|
|
want: &action.UpdateTargetResponse{
|
2024-02-15 05:39:10 +00:00
|
|
|
Details: &object.Details{
|
|
|
|
ChangeDate: timestamppb.Now(),
|
|
|
|
ResourceOwner: Tester.Instance.InstanceID(),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "change url, ok",
|
2024-04-09 17:21:21 +00:00
|
|
|
prepare: func(request *action.UpdateTargetRequest) error {
|
2024-05-04 09:55:57 +00:00
|
|
|
targetID := Tester.CreateTarget(CTX, t, "", "https://example.com", domain.TargetTypeWebhook, false).GetId()
|
2024-02-15 05:39:10 +00:00
|
|
|
request.TargetId = targetID
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: CTX,
|
2024-04-09 17:21:21 +00:00
|
|
|
req: &action.UpdateTargetRequest{
|
2024-05-04 09:55:57 +00:00
|
|
|
Endpoint: gu.Ptr("https://example.com/hooks/new"),
|
2024-02-15 05:39:10 +00:00
|
|
|
},
|
|
|
|
},
|
2024-04-09 17:21:21 +00:00
|
|
|
want: &action.UpdateTargetResponse{
|
2024-02-15 05:39:10 +00:00
|
|
|
Details: &object.Details{
|
|
|
|
ChangeDate: timestamppb.Now(),
|
|
|
|
ResourceOwner: Tester.Instance.InstanceID(),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "change timeout, ok",
|
2024-04-09 17:21:21 +00:00
|
|
|
prepare: func(request *action.UpdateTargetRequest) error {
|
2024-05-04 09:55:57 +00:00
|
|
|
targetID := Tester.CreateTarget(CTX, t, "", "https://example.com", domain.TargetTypeWebhook, false).GetId()
|
2024-02-15 05:39:10 +00:00
|
|
|
request.TargetId = targetID
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: CTX,
|
2024-04-09 17:21:21 +00:00
|
|
|
req: &action.UpdateTargetRequest{
|
2024-02-15 05:39:10 +00:00
|
|
|
Timeout: durationpb.New(20 * time.Second),
|
|
|
|
},
|
|
|
|
},
|
2024-04-09 17:21:21 +00:00
|
|
|
want: &action.UpdateTargetResponse{
|
2024-02-15 05:39:10 +00:00
|
|
|
Details: &object.Details{
|
|
|
|
ChangeDate: timestamppb.Now(),
|
|
|
|
ResourceOwner: Tester.Instance.InstanceID(),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2024-05-04 09:55:57 +00:00
|
|
|
name: "change type async, ok",
|
2024-04-09 17:21:21 +00:00
|
|
|
prepare: func(request *action.UpdateTargetRequest) error {
|
2024-05-04 09:55:57 +00:00
|
|
|
targetID := Tester.CreateTarget(CTX, t, "", "https://example.com", domain.TargetTypeAsync, false).GetId()
|
2024-02-15 05:39:10 +00:00
|
|
|
request.TargetId = targetID
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: CTX,
|
2024-04-09 17:21:21 +00:00
|
|
|
req: &action.UpdateTargetRequest{
|
2024-05-04 09:55:57 +00:00
|
|
|
TargetType: &action.UpdateTargetRequest_RestAsync{
|
|
|
|
RestAsync: &action.SetRESTAsync{},
|
2024-02-15 05:39:10 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-04-09 17:21:21 +00:00
|
|
|
want: &action.UpdateTargetResponse{
|
2024-02-15 05:39:10 +00:00
|
|
|
Details: &object.Details{
|
|
|
|
ChangeDate: timestamppb.Now(),
|
|
|
|
ResourceOwner: Tester.Instance.InstanceID(),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
|
|
err := tt.prepare(tt.args.req)
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
got, err := Client.UpdateTarget(tt.args.ctx, tt.args.req)
|
|
|
|
if tt.wantErr {
|
|
|
|
require.Error(t, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
require.NoError(t, err)
|
|
|
|
integration.AssertDetails(t, tt.want, got)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestServer_DeleteTarget(t *testing.T) {
|
2024-04-09 17:21:21 +00:00
|
|
|
ensureFeatureEnabled(t)
|
2024-05-04 09:55:57 +00:00
|
|
|
target := Tester.CreateTarget(CTX, t, "", "https://example.com", domain.TargetTypeWebhook, false)
|
2024-02-15 05:39:10 +00:00
|
|
|
tests := []struct {
|
|
|
|
name string
|
|
|
|
ctx context.Context
|
2024-04-09 17:21:21 +00:00
|
|
|
req *action.DeleteTargetRequest
|
|
|
|
want *action.DeleteTargetResponse
|
2024-02-15 05:39:10 +00:00
|
|
|
wantErr bool
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "missing permission",
|
|
|
|
ctx: Tester.WithAuthorization(context.Background(), integration.OrgOwner),
|
2024-04-09 17:21:21 +00:00
|
|
|
req: &action.DeleteTargetRequest{
|
2024-02-15 05:39:10 +00:00
|
|
|
TargetId: target.GetId(),
|
|
|
|
},
|
|
|
|
wantErr: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "empty id",
|
|
|
|
ctx: CTX,
|
2024-04-09 17:21:21 +00:00
|
|
|
req: &action.DeleteTargetRequest{
|
2024-02-15 05:39:10 +00:00
|
|
|
TargetId: "",
|
|
|
|
},
|
|
|
|
wantErr: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "delete target",
|
|
|
|
ctx: CTX,
|
2024-04-09 17:21:21 +00:00
|
|
|
req: &action.DeleteTargetRequest{
|
2024-02-15 05:39:10 +00:00
|
|
|
TargetId: target.GetId(),
|
|
|
|
},
|
2024-04-09 17:21:21 +00:00
|
|
|
want: &action.DeleteTargetResponse{
|
2024-02-15 05:39:10 +00:00
|
|
|
Details: &object.Details{
|
|
|
|
ChangeDate: timestamppb.Now(),
|
|
|
|
ResourceOwner: Tester.Instance.InstanceID(),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
|
|
got, err := Client.DeleteTarget(tt.ctx, tt.req)
|
|
|
|
if tt.wantErr {
|
|
|
|
require.Error(t, err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
require.NoError(t, err)
|
|
|
|
integration.AssertDetails(t, tt.want, got)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|