mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 04:57:33 +00:00
Merge branch 'main' into move-go
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
"github.com/zitadel/zitadel/internal/repository/execution"
|
||||
"github.com/zitadel/zitadel/internal/zerrors"
|
||||
action "github.com/zitadel/zitadel/pkg/grpc/action/v2beta"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/action/v2"
|
||||
)
|
||||
|
||||
func (s *Server) SetExecution(ctx context.Context, req *connect.Request[action.SetExecutionRequest]) (*connect.Response[action.SetExecutionResponse], error) {
|
@@ -28,7 +28,7 @@ import (
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
"github.com/zitadel/zitadel/internal/integration"
|
||||
"github.com/zitadel/zitadel/internal/query"
|
||||
action "github.com/zitadel/zitadel/pkg/grpc/action/v2beta"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/action/v2"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/app"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/management"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/metadata"
|
||||
@@ -48,7 +48,7 @@ var (
|
||||
|
||||
func TestServer_ExecutionTarget(t *testing.T) {
|
||||
instance := integration.NewInstance(CTX)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
fullMethod := action.ActionService_GetTarget_FullMethodName
|
||||
|
||||
tests := []struct {
|
||||
@@ -272,7 +272,7 @@ func TestServer_ExecutionTarget(t *testing.T) {
|
||||
|
||||
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(tt.ctx, time.Minute)
|
||||
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||
got, err := instance.Client.ActionV2beta.GetTarget(tt.ctx, tt.req)
|
||||
got, err := instance.Client.ActionV2.GetTarget(tt.ctx, tt.req)
|
||||
if tt.wantErr {
|
||||
require.Error(ttt, err)
|
||||
return
|
||||
@@ -292,7 +292,7 @@ func TestServer_ExecutionTarget(t *testing.T) {
|
||||
|
||||
func TestServer_ExecutionTarget_Event(t *testing.T) {
|
||||
instance := integration.NewInstance(CTX)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
|
||||
event := "session.added"
|
||||
urlRequest, closeF, calledF, resetF := integration.TestServerCall(nil, 0, http.StatusOK, nil)
|
||||
@@ -349,7 +349,7 @@ func TestServer_ExecutionTarget_Event(t *testing.T) {
|
||||
|
||||
func TestServer_ExecutionTarget_Event_LongerThanTargetTimeout(t *testing.T) {
|
||||
instance := integration.NewInstance(CTX)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
|
||||
event := "session.added"
|
||||
// call takes longer than timeout of target
|
||||
@@ -401,7 +401,7 @@ func TestServer_ExecutionTarget_Event_LongerThanTargetTimeout(t *testing.T) {
|
||||
|
||||
func TestServer_ExecutionTarget_Event_LongerThanTransactionTimeout(t *testing.T) {
|
||||
instance := integration.NewInstance(CTX)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
|
||||
event := "session.added"
|
||||
urlRequest, closeF, calledF, resetF := integration.TestServerCall(nil, 1*time.Second, http.StatusOK, nil)
|
||||
@@ -467,7 +467,7 @@ func waitForExecutionOnCondition(ctx context.Context, t *testing.T, instance *in
|
||||
|
||||
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(ctx, time.Minute)
|
||||
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||
got, err := instance.Client.ActionV2beta.ListExecutions(ctx, &action.ListExecutionsRequest{
|
||||
got, err := instance.Client.ActionV2.ListExecutions(ctx, &action.ListExecutionsRequest{
|
||||
Filters: []*action.ExecutionSearchFilter{
|
||||
{Filter: &action.ExecutionSearchFilter_InConditionsFilter{
|
||||
InConditionsFilter: &action.InConditionsFilter{Conditions: []*action.Condition{condition}},
|
||||
@@ -488,7 +488,6 @@ func waitForExecutionOnCondition(ctx context.Context, t *testing.T, instance *in
|
||||
}
|
||||
}
|
||||
}, retryDuration, tick, "timeout waiting for expected execution result")
|
||||
return
|
||||
}
|
||||
|
||||
func waitForTarget(ctx context.Context, t *testing.T, instance *integration.Instance, endpoint string, ty domain.TargetType, interrupt bool) *action.CreateTargetResponse {
|
||||
@@ -496,7 +495,7 @@ func waitForTarget(ctx context.Context, t *testing.T, instance *integration.Inst
|
||||
|
||||
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(ctx, time.Minute)
|
||||
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||
got, err := instance.Client.ActionV2beta.ListTargets(ctx, &action.ListTargetsRequest{
|
||||
got, err := instance.Client.ActionV2.ListTargets(ctx, &action.ListTargetsRequest{
|
||||
Filters: []*action.TargetSearchFilter{
|
||||
{Filter: &action.TargetSearchFilter_InTargetIdsFilter{
|
||||
InTargetIdsFilter: &action.InTargetIDsFilter{TargetIds: []string{resp.GetId()}},
|
||||
@@ -577,8 +576,8 @@ func conditionFunction(function string) *action.Condition {
|
||||
|
||||
func TestServer_ExecutionTargetPreUserinfo(t *testing.T) {
|
||||
instance := integration.NewInstance(CTX)
|
||||
isolatedIAMCtx := instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
ctxLoginClient := instance.WithAuthorization(CTX, integration.UserTypeLogin)
|
||||
isolatedIAMCtx := instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
ctxLoginClient := instance.WithAuthorizationToken(CTX, integration.UserTypeLogin)
|
||||
|
||||
client, err := instance.CreateOIDCImplicitFlowClient(isolatedIAMCtx, t, redirectURIImplicit, loginV2)
|
||||
require.NoError(t, err)
|
||||
@@ -893,8 +892,8 @@ func contextInfoForUserOIDC(instance *integration.Instance, function string, cli
|
||||
|
||||
func TestServer_ExecutionTargetPreAccessToken(t *testing.T) {
|
||||
instance := integration.NewInstance(CTX)
|
||||
isolatedIAMCtx := instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
ctxLoginClient := instance.WithAuthorization(CTX, integration.UserTypeLogin)
|
||||
isolatedIAMCtx := instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
ctxLoginClient := instance.WithAuthorizationToken(CTX, integration.UserTypeLogin)
|
||||
|
||||
client, err := instance.CreateOIDCImplicitFlowClient(isolatedIAMCtx, t, redirectURIImplicit, loginV2)
|
||||
require.NoError(t, err)
|
||||
@@ -1086,8 +1085,8 @@ func expectPreAccessTokenExecution(ctx context.Context, t *testing.T, instance *
|
||||
|
||||
func TestServer_ExecutionTargetPreSAMLResponse(t *testing.T) {
|
||||
instance := integration.NewInstance(CTX)
|
||||
isolatedIAMCtx := instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
ctxLoginClient := instance.WithAuthorization(CTX, integration.UserTypeLogin)
|
||||
isolatedIAMCtx := instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
ctxLoginClient := instance.WithAuthorizationToken(CTX, integration.UserTypeLogin)
|
||||
|
||||
idpMetadata, err := instance.GetSAMLIDPMetadata()
|
||||
require.NoError(t, err)
|
@@ -12,12 +12,12 @@ import (
|
||||
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
"github.com/zitadel/zitadel/internal/integration"
|
||||
action "github.com/zitadel/zitadel/pkg/grpc/action/v2beta"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/action/v2"
|
||||
)
|
||||
|
||||
func TestServer_SetExecution_Request(t *testing.T) {
|
||||
instance := integration.NewInstance(CTX)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
targetResp := instance.CreateTarget(isolatedIAMOwnerCTX, t, "", "https://notexisting", domain.TargetTypeWebhook, false)
|
||||
|
||||
tests := []struct {
|
||||
@@ -29,7 +29,7 @@ func TestServer_SetExecution_Request(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "missing permission",
|
||||
ctx: instance.WithAuthorization(context.Background(), integration.UserTypeOrgOwner),
|
||||
ctx: instance.WithAuthorizationToken(context.Background(), integration.UserTypeOrgOwner),
|
||||
req: &action.SetExecutionRequest{
|
||||
Condition: &action.Condition{
|
||||
ConditionType: &action.Condition_Request{
|
||||
@@ -62,7 +62,7 @@ func TestServer_SetExecution_Request(t *testing.T) {
|
||||
ConditionType: &action.Condition_Request{
|
||||
Request: &action.RequestExecution{
|
||||
Condition: &action.RequestExecution_Method{
|
||||
Method: "/zitadel.session.v2beta.NotExistingService/List",
|
||||
Method: "/zitadel.session.v2.NotExistingService/List",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -79,7 +79,7 @@ func TestServer_SetExecution_Request(t *testing.T) {
|
||||
ConditionType: &action.Condition_Request{
|
||||
Request: &action.RequestExecution{
|
||||
Condition: &action.RequestExecution_Method{
|
||||
Method: "/zitadel.session.v2beta.SessionService/ListSessions",
|
||||
Method: "/zitadel.session.v2.SessionService/ListSessions",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -113,7 +113,7 @@ func TestServer_SetExecution_Request(t *testing.T) {
|
||||
ConditionType: &action.Condition_Request{
|
||||
Request: &action.RequestExecution{
|
||||
Condition: &action.RequestExecution_Service{
|
||||
Service: "zitadel.session.v2beta.SessionService",
|
||||
Service: "zitadel.session.v2.SessionService",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -144,7 +144,7 @@ func TestServer_SetExecution_Request(t *testing.T) {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
// We want to have the same response no matter how often we call the function
|
||||
creationDate := time.Now().UTC()
|
||||
got, err := instance.Client.ActionV2beta.SetExecution(tt.ctx, tt.req)
|
||||
got, err := instance.Client.ActionV2.SetExecution(tt.ctx, tt.req)
|
||||
setDate := time.Now().UTC()
|
||||
if tt.wantErr {
|
||||
assert.Error(t, err)
|
||||
@@ -174,7 +174,7 @@ func assertSetExecutionResponse(t *testing.T, creationDate, setDate time.Time, e
|
||||
|
||||
func TestServer_SetExecution_Response(t *testing.T) {
|
||||
instance := integration.NewInstance(CTX)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
targetResp := instance.CreateTarget(isolatedIAMOwnerCTX, t, "", "https://notexisting", domain.TargetTypeWebhook, false)
|
||||
|
||||
tests := []struct {
|
||||
@@ -186,7 +186,7 @@ func TestServer_SetExecution_Response(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "missing permission",
|
||||
ctx: instance.WithAuthorization(context.Background(), integration.UserTypeOrgOwner),
|
||||
ctx: instance.WithAuthorizationToken(context.Background(), integration.UserTypeOrgOwner),
|
||||
req: &action.SetExecutionRequest{
|
||||
Condition: &action.Condition{
|
||||
ConditionType: &action.Condition_Response{
|
||||
@@ -219,7 +219,7 @@ func TestServer_SetExecution_Response(t *testing.T) {
|
||||
ConditionType: &action.Condition_Response{
|
||||
Response: &action.ResponseExecution{
|
||||
Condition: &action.ResponseExecution_Method{
|
||||
Method: "/zitadel.session.v2beta.NotExistingService/List",
|
||||
Method: "/zitadel.session.v2.NotExistingService/List",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -236,7 +236,7 @@ func TestServer_SetExecution_Response(t *testing.T) {
|
||||
ConditionType: &action.Condition_Response{
|
||||
Response: &action.ResponseExecution{
|
||||
Condition: &action.ResponseExecution_Method{
|
||||
Method: "/zitadel.session.v2beta.SessionService/ListSessions",
|
||||
Method: "/zitadel.session.v2.SessionService/ListSessions",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -270,7 +270,7 @@ func TestServer_SetExecution_Response(t *testing.T) {
|
||||
ConditionType: &action.Condition_Response{
|
||||
Response: &action.ResponseExecution{
|
||||
Condition: &action.ResponseExecution_Service{
|
||||
Service: "zitadel.session.v2beta.SessionService",
|
||||
Service: "zitadel.session.v2.SessionService",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -300,7 +300,7 @@ func TestServer_SetExecution_Response(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
creationDate := time.Now().UTC()
|
||||
got, err := instance.Client.ActionV2beta.SetExecution(tt.ctx, tt.req)
|
||||
got, err := instance.Client.ActionV2.SetExecution(tt.ctx, tt.req)
|
||||
setDate := time.Now().UTC()
|
||||
if tt.wantErr {
|
||||
require.Error(t, err)
|
||||
@@ -318,7 +318,7 @@ func TestServer_SetExecution_Response(t *testing.T) {
|
||||
|
||||
func TestServer_SetExecution_Event(t *testing.T) {
|
||||
instance := integration.NewInstance(CTX)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
targetResp := instance.CreateTarget(isolatedIAMOwnerCTX, t, "", "https://notexisting", domain.TargetTypeWebhook, false)
|
||||
|
||||
tests := []struct {
|
||||
@@ -330,7 +330,7 @@ func TestServer_SetExecution_Event(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "missing permission",
|
||||
ctx: instance.WithAuthorization(context.Background(), integration.UserTypeOrgOwner),
|
||||
ctx: instance.WithAuthorizationToken(context.Background(), integration.UserTypeOrgOwner),
|
||||
req: &action.SetExecutionRequest{
|
||||
Condition: &action.Condition{
|
||||
ConditionType: &action.Condition_Event{
|
||||
@@ -463,7 +463,7 @@ func TestServer_SetExecution_Event(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
creationDate := time.Now().UTC()
|
||||
got, err := instance.Client.ActionV2beta.SetExecution(tt.ctx, tt.req)
|
||||
got, err := instance.Client.ActionV2.SetExecution(tt.ctx, tt.req)
|
||||
setDate := time.Now().UTC()
|
||||
if tt.wantErr {
|
||||
require.Error(t, err)
|
||||
@@ -481,7 +481,7 @@ func TestServer_SetExecution_Event(t *testing.T) {
|
||||
|
||||
func TestServer_SetExecution_Function(t *testing.T) {
|
||||
instance := integration.NewInstance(CTX)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
targetResp := instance.CreateTarget(isolatedIAMOwnerCTX, t, "", "https://notexisting", domain.TargetTypeWebhook, false)
|
||||
|
||||
tests := []struct {
|
||||
@@ -493,7 +493,7 @@ func TestServer_SetExecution_Function(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "missing permission",
|
||||
ctx: instance.WithAuthorization(context.Background(), integration.UserTypeOrgOwner),
|
||||
ctx: instance.WithAuthorizationToken(context.Background(), integration.UserTypeOrgOwner),
|
||||
req: &action.SetExecutionRequest{
|
||||
Condition: &action.Condition{
|
||||
ConditionType: &action.Condition_Response{
|
||||
@@ -548,7 +548,7 @@ func TestServer_SetExecution_Function(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
creationDate := time.Now().UTC()
|
||||
got, err := instance.Client.ActionV2beta.SetExecution(tt.ctx, tt.req)
|
||||
got, err := instance.Client.ActionV2.SetExecution(tt.ctx, tt.req)
|
||||
setDate := time.Now().UTC()
|
||||
if tt.wantErr {
|
||||
require.Error(t, err)
|
@@ -15,13 +15,13 @@ import (
|
||||
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
"github.com/zitadel/zitadel/internal/integration"
|
||||
action "github.com/zitadel/zitadel/pkg/grpc/action/v2beta"
|
||||
filter "github.com/zitadel/zitadel/pkg/grpc/filter/v2beta"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/action/v2"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/filter/v2"
|
||||
)
|
||||
|
||||
func TestServer_GetTarget(t *testing.T) {
|
||||
instance := integration.NewInstance(CTX)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
dep func(context.Context, *action.GetTargetRequest, *action.GetTargetResponse) error
|
||||
@@ -36,7 +36,7 @@ func TestServer_GetTarget(t *testing.T) {
|
||||
{
|
||||
name: "missing permission",
|
||||
args: args{
|
||||
ctx: instance.WithAuthorization(context.Background(), integration.UserTypeOrgOwner),
|
||||
ctx: instance.WithAuthorizationToken(context.Background(), integration.UserTypeOrgOwner),
|
||||
req: &action.GetTargetRequest{},
|
||||
},
|
||||
wantErr: true,
|
||||
@@ -199,7 +199,7 @@ func TestServer_GetTarget(t *testing.T) {
|
||||
}
|
||||
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(isolatedIAMOwnerCTX, 2*time.Minute)
|
||||
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||
got, err := instance.Client.ActionV2beta.GetTarget(tt.args.ctx, tt.args.req)
|
||||
got, err := instance.Client.ActionV2.GetTarget(tt.args.ctx, tt.args.req)
|
||||
if tt.wantErr {
|
||||
assert.Error(ttt, err, "Error: "+err.Error())
|
||||
return
|
||||
@@ -213,7 +213,7 @@ func TestServer_GetTarget(t *testing.T) {
|
||||
|
||||
func TestServer_ListTargets(t *testing.T) {
|
||||
instance := integration.NewInstance(CTX)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
dep func(context.Context, *action.ListTargetsRequest, *action.ListTargetsResponse)
|
||||
@@ -228,7 +228,7 @@ func TestServer_ListTargets(t *testing.T) {
|
||||
{
|
||||
name: "missing permission",
|
||||
args: args{
|
||||
ctx: instance.WithAuthorization(context.Background(), integration.UserTypeOrgOwner),
|
||||
ctx: instance.WithAuthorizationToken(context.Background(), integration.UserTypeOrgOwner),
|
||||
req: &action.ListTargetsRequest{},
|
||||
},
|
||||
wantErr: true,
|
||||
@@ -419,7 +419,7 @@ func TestServer_ListTargets(t *testing.T) {
|
||||
|
||||
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(isolatedIAMOwnerCTX, time.Minute)
|
||||
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||
got, listErr := instance.Client.ActionV2beta.ListTargets(tt.args.ctx, tt.args.req)
|
||||
got, listErr := instance.Client.ActionV2.ListTargets(tt.args.ctx, tt.args.req)
|
||||
if tt.wantErr {
|
||||
require.Error(ttt, listErr, "Error: "+listErr.Error())
|
||||
return
|
||||
@@ -445,7 +445,7 @@ func assertPaginationResponse(t *assert.CollectT, expected *filter.PaginationRes
|
||||
|
||||
func TestServer_ListExecutions(t *testing.T) {
|
||||
instance := integration.NewInstance(CTX)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
targetResp := instance.CreateTarget(isolatedIAMOwnerCTX, t, "", "https://example.com", domain.TargetTypeWebhook, false)
|
||||
|
||||
type args struct {
|
||||
@@ -462,7 +462,7 @@ func TestServer_ListExecutions(t *testing.T) {
|
||||
{
|
||||
name: "missing permission",
|
||||
args: args{
|
||||
ctx: instance.WithAuthorization(context.Background(), integration.UserTypeOrgOwner),
|
||||
ctx: instance.WithAuthorizationToken(context.Background(), integration.UserTypeOrgOwner),
|
||||
req: &action.ListExecutionsRequest{},
|
||||
},
|
||||
wantErr: true,
|
||||
@@ -767,7 +767,7 @@ func TestServer_ListExecutions(t *testing.T) {
|
||||
|
||||
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(isolatedIAMOwnerCTX, time.Minute)
|
||||
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||
got, listErr := instance.Client.ActionV2beta.ListExecutions(tt.args.ctx, tt.args.req)
|
||||
got, listErr := instance.Client.ActionV2.ListExecutions(tt.args.ctx, tt.args.req)
|
||||
if tt.wantErr {
|
||||
require.Error(ttt, listErr, "Error: "+listErr.Error())
|
||||
return
|
@@ -14,12 +14,12 @@ import (
|
||||
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
"github.com/zitadel/zitadel/internal/integration"
|
||||
action "github.com/zitadel/zitadel/pkg/grpc/action/v2beta"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/action/v2"
|
||||
)
|
||||
|
||||
func TestServer_CreateTarget(t *testing.T) {
|
||||
instance := integration.NewInstance(CTX)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
type want struct {
|
||||
id bool
|
||||
creationDate bool
|
||||
@@ -36,7 +36,7 @@ func TestServer_CreateTarget(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "missing permission",
|
||||
ctx: instance.WithAuthorization(context.Background(), integration.UserTypeOrgOwner),
|
||||
ctx: instance.WithAuthorizationToken(context.Background(), integration.UserTypeOrgOwner),
|
||||
req: &action.CreateTargetRequest{
|
||||
Name: gofakeit.Name(),
|
||||
},
|
||||
@@ -205,7 +205,7 @@ func TestServer_CreateTarget(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
creationDate := time.Now().UTC()
|
||||
got, err := instance.Client.ActionV2beta.CreateTarget(tt.ctx, tt.req)
|
||||
got, err := instance.Client.ActionV2.CreateTarget(tt.ctx, tt.req)
|
||||
changeDate := time.Now().UTC()
|
||||
if tt.wantErr {
|
||||
assert.Error(t, err)
|
||||
@@ -243,7 +243,7 @@ func assertCreateTargetResponse(t *testing.T, creationDate, changeDate time.Time
|
||||
|
||||
func TestServer_UpdateTarget(t *testing.T) {
|
||||
instance := integration.NewInstance(CTX)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
isolatedIAMOwnerCTX := instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
req *action.UpdateTargetRequest
|
||||
@@ -267,7 +267,7 @@ func TestServer_UpdateTarget(t *testing.T) {
|
||||
request.Id = targetID
|
||||
},
|
||||
args: args{
|
||||
ctx: instance.WithAuthorization(context.Background(), integration.UserTypeOrgOwner),
|
||||
ctx: instance.WithAuthorizationToken(context.Background(), integration.UserTypeOrgOwner),
|
||||
req: &action.UpdateTargetRequest{
|
||||
Name: gu.Ptr(gofakeit.Name()),
|
||||
},
|
||||
@@ -278,7 +278,6 @@ func TestServer_UpdateTarget(t *testing.T) {
|
||||
name: "not existing",
|
||||
prepare: func(request *action.UpdateTargetRequest) {
|
||||
request.Id = "notexisting"
|
||||
return
|
||||
},
|
||||
args: args{
|
||||
ctx: isolatedIAMOwnerCTX,
|
||||
@@ -426,7 +425,7 @@ func TestServer_UpdateTarget(t *testing.T) {
|
||||
creationDate := time.Now().UTC()
|
||||
tt.prepare(tt.args.req)
|
||||
|
||||
got, err := instance.Client.ActionV2beta.UpdateTarget(tt.args.ctx, tt.args.req)
|
||||
got, err := instance.Client.ActionV2.UpdateTarget(tt.args.ctx, tt.args.req)
|
||||
if tt.wantErr {
|
||||
assert.Error(t, err)
|
||||
return
|
||||
@@ -461,7 +460,7 @@ func assertUpdateTargetResponse(t *testing.T, creationDate, changeDate time.Time
|
||||
|
||||
func TestServer_DeleteTarget(t *testing.T) {
|
||||
instance := integration.NewInstance(CTX)
|
||||
iamOwnerCtx := instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
iamOwnerCtx := instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
tests := []struct {
|
||||
name string
|
||||
ctx context.Context
|
||||
@@ -472,7 +471,7 @@ func TestServer_DeleteTarget(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "missing permission",
|
||||
ctx: instance.WithAuthorization(context.Background(), integration.UserTypeOrgOwner),
|
||||
ctx: instance.WithAuthorizationToken(context.Background(), integration.UserTypeOrgOwner),
|
||||
req: &action.DeleteTargetRequest{
|
||||
Id: "notexisting",
|
||||
},
|
||||
@@ -526,7 +525,7 @@ func TestServer_DeleteTarget(t *testing.T) {
|
||||
if tt.prepare != nil {
|
||||
creationDate, deletionDate = tt.prepare(tt.req)
|
||||
}
|
||||
got, err := instance.Client.ActionV2beta.DeleteTarget(tt.ctx, tt.req)
|
||||
got, err := instance.Client.ActionV2.DeleteTarget(tt.ctx, tt.req)
|
||||
if tt.wantErr {
|
||||
assert.Error(t, err)
|
||||
return
|
@@ -8,12 +8,12 @@ import (
|
||||
"google.golang.org/protobuf/types/known/durationpb"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
|
||||
filter "github.com/zitadel/zitadel/internal/api/grpc/filter/v2beta"
|
||||
"github.com/zitadel/zitadel/internal/api/grpc/filter/v2"
|
||||
"github.com/zitadel/zitadel/internal/command"
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
"github.com/zitadel/zitadel/internal/query"
|
||||
"github.com/zitadel/zitadel/internal/zerrors"
|
||||
action "github.com/zitadel/zitadel/pkg/grpc/action/v2beta"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/action/v2"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -82,7 +82,7 @@ func targetsToPb(targets []*query.Target) []*action.Target {
|
||||
|
||||
func targetToPb(t *query.Target) *action.Target {
|
||||
target := &action.Target{
|
||||
Id: t.ObjectDetails.ID,
|
||||
Id: t.ID,
|
||||
Name: t.Name,
|
||||
Timeout: durationpb.New(t.Timeout),
|
||||
Endpoint: t.Endpoint,
|
||||
@@ -99,11 +99,11 @@ func targetToPb(t *query.Target) *action.Target {
|
||||
target.TargetType = nil
|
||||
}
|
||||
|
||||
if !t.ObjectDetails.EventDate.IsZero() {
|
||||
target.ChangeDate = timestamppb.New(t.ObjectDetails.EventDate)
|
||||
if !t.EventDate.IsZero() {
|
||||
target.ChangeDate = timestamppb.New(t.EventDate)
|
||||
}
|
||||
if !t.ObjectDetails.CreationDate.IsZero() {
|
||||
target.CreationDate = timestamppb.New(t.ObjectDetails.CreationDate)
|
||||
if !t.CreationDate.IsZero() {
|
||||
target.CreationDate = timestamppb.New(t.CreationDate)
|
||||
}
|
||||
return target
|
||||
}
|
||||
@@ -334,11 +334,11 @@ func executionToPb(e *query.Execution) *action.Execution {
|
||||
Condition: executionIDToCondition(e.ID),
|
||||
Targets: targets,
|
||||
}
|
||||
if !e.ObjectDetails.EventDate.IsZero() {
|
||||
exec.ChangeDate = timestamppb.New(e.ObjectDetails.EventDate)
|
||||
if !e.EventDate.IsZero() {
|
||||
exec.ChangeDate = timestamppb.New(e.EventDate)
|
||||
}
|
||||
if !e.ObjectDetails.CreationDate.IsZero() {
|
||||
exec.CreationDate = timestamppb.New(e.ObjectDetails.CreationDate)
|
||||
if !e.CreationDate.IsZero() {
|
||||
exec.CreationDate = timestamppb.New(e.CreationDate)
|
||||
}
|
||||
return exec
|
||||
}
|
@@ -11,8 +11,8 @@ import (
|
||||
"github.com/zitadel/zitadel/internal/command"
|
||||
"github.com/zitadel/zitadel/internal/config/systemdefaults"
|
||||
"github.com/zitadel/zitadel/internal/query"
|
||||
action "github.com/zitadel/zitadel/pkg/grpc/action/v2beta"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/action/v2beta/actionconnect"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/action/v2"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/action/v2/actionconnect"
|
||||
)
|
||||
|
||||
var _ actionconnect.ActionServiceHandler = (*Server)(nil)
|
||||
@@ -51,7 +51,7 @@ func (s *Server) RegisterConnectServer(interceptors ...connect.Interceptor) (str
|
||||
}
|
||||
|
||||
func (s *Server) FileDescriptor() protoreflect.FileDescriptor {
|
||||
return action.File_zitadel_action_v2beta_action_service_proto
|
||||
return action.File_zitadel_action_v2_action_service_proto
|
||||
}
|
||||
|
||||
func (s *Server) AppName() string {
|
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/zitadel/zitadel/internal/command"
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
"github.com/zitadel/zitadel/internal/eventstore/v1/models"
|
||||
action "github.com/zitadel/zitadel/pkg/grpc/action/v2beta"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/action/v2"
|
||||
)
|
||||
|
||||
func (s *Server) CreateTarget(ctx context.Context, req *connect.Request[action.CreateTargetRequest]) (*connect.Response[action.CreateTargetResponse], error) {
|
||||
@@ -89,11 +89,8 @@ func createTargetToCommand(req *action.CreateTargetRequest) *command.AddTarget {
|
||||
}
|
||||
|
||||
func updateTargetToCommand(req *action.UpdateTargetRequest) *command.ChangeTarget {
|
||||
expirationSigningKey := false
|
||||
// TODO handle expiration, currently only immediate expiration is supported
|
||||
if req.GetExpirationSigningKey() != nil {
|
||||
expirationSigningKey = true
|
||||
}
|
||||
expirationSigningKey := req.GetExpirationSigningKey() != nil
|
||||
|
||||
if req == nil {
|
||||
return nil
|
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"github.com/zitadel/zitadel/internal/command"
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
action "github.com/zitadel/zitadel/pkg/grpc/action/v2beta"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/action/v2"
|
||||
)
|
||||
|
||||
func Test_createTargetToCommand(t *testing.T) {
|
@@ -6,6 +6,7 @@ import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/beevik/etree"
|
||||
@@ -75,21 +76,31 @@ func (s *Session) FetchUser(ctx context.Context) (user idp.User, err error) {
|
||||
return nil, zerrors.ThrowInvalidArgument(err, "SAML-nuo0vphhh9", "Errors.Intent.ResponseInvalid")
|
||||
}
|
||||
|
||||
userMapper := NewUser()
|
||||
// nameID is required, but at least in ADFS it will not be sent unless explicitly configured
|
||||
if s.Assertion.Subject == nil || s.Assertion.Subject.NameID == nil {
|
||||
return nil, zerrors.ThrowInvalidArgument(err, "SAML-EFG32", "Errors.Intent.ResponseInvalid")
|
||||
}
|
||||
nameID := s.Assertion.Subject.NameID
|
||||
userMapper := NewUser()
|
||||
// use the nameID as default mapping id
|
||||
userMapper.SetID(nameID.Value)
|
||||
if nameID.Format == string(saml.TransientNameIDFormat) {
|
||||
if strings.TrimSpace(s.TransientMappingAttributeName) == "" {
|
||||
return nil, zerrors.ThrowInvalidArgument(err, "SAML-EFG32", "Errors.Intent.MissingTransientMappingAttributeName")
|
||||
}
|
||||
// workaround to use the transient mapping attribute when the subject / nameID are missing (e.g. in ADFS, Shibboleth)
|
||||
mappingID, err := s.transientMappingID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
userMapper.SetID(mappingID)
|
||||
} else {
|
||||
nameID := s.Assertion.Subject.NameID
|
||||
// use the nameID as default mapping id
|
||||
userMapper.SetID(nameID.Value)
|
||||
if nameID.Format == string(saml.TransientNameIDFormat) {
|
||||
mappingID, err := s.transientMappingID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
userMapper.SetID(mappingID)
|
||||
}
|
||||
}
|
||||
|
||||
for _, statement := range s.Assertion.AttributeStatements {
|
||||
for _, attribute := range statement.Attributes {
|
||||
values := make([]string, len(attribute.Values))
|
||||
|
File diff suppressed because one or more lines are too long
@@ -21,7 +21,8 @@ import (
|
||||
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
"github.com/zitadel/zitadel/internal/integration/scim"
|
||||
action "github.com/zitadel/zitadel/pkg/grpc/action/v2beta"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/action/v2"
|
||||
action_v2beta "github.com/zitadel/zitadel/pkg/grpc/action/v2beta"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/admin"
|
||||
app "github.com/zitadel/zitadel/pkg/grpc/app/v2beta"
|
||||
"github.com/zitadel/zitadel/pkg/grpc/auth"
|
||||
@@ -69,7 +70,8 @@ type Client struct {
|
||||
OIDCv2 oidc_pb.OIDCServiceClient
|
||||
OrgV2beta org_v2beta.OrganizationServiceClient
|
||||
OrgV2 org.OrganizationServiceClient
|
||||
ActionV2beta action.ActionServiceClient
|
||||
ActionV2beta action_v2beta.ActionServiceClient
|
||||
ActionV2 action.ActionServiceClient
|
||||
FeatureV2beta feature_v2beta.FeatureServiceClient
|
||||
FeatureV2 feature.FeatureServiceClient
|
||||
UserSchemaV3 userschema_v3alpha.ZITADELUserSchemasClient
|
||||
@@ -112,7 +114,8 @@ func newClient(ctx context.Context, target string) (*Client, error) {
|
||||
OIDCv2: oidc_pb.NewOIDCServiceClient(cc),
|
||||
OrgV2beta: org_v2beta.NewOrganizationServiceClient(cc),
|
||||
OrgV2: org.NewOrganizationServiceClient(cc),
|
||||
ActionV2beta: action.NewActionServiceClient(cc),
|
||||
ActionV2beta: action_v2beta.NewActionServiceClient(cc),
|
||||
ActionV2: action.NewActionServiceClient(cc),
|
||||
FeatureV2beta: feature_v2beta.NewFeatureServiceClient(cc),
|
||||
FeatureV2: feature.NewFeatureServiceClient(cc),
|
||||
UserSchemaV3: userschema_v3alpha.NewZITADELUserSchemasClient(cc),
|
||||
@@ -1057,27 +1060,27 @@ func (i *Instance) CreateTarget(ctx context.Context, t *testing.T, name, endpoin
|
||||
RestAsync: &action.RESTAsync{},
|
||||
}
|
||||
}
|
||||
target, err := i.Client.ActionV2beta.CreateTarget(ctx, req)
|
||||
target, err := i.Client.ActionV2.CreateTarget(ctx, req)
|
||||
require.NoError(t, err)
|
||||
return target
|
||||
}
|
||||
|
||||
func (i *Instance) DeleteTarget(ctx context.Context, t *testing.T, id string) {
|
||||
_, err := i.Client.ActionV2beta.DeleteTarget(ctx, &action.DeleteTargetRequest{
|
||||
_, err := i.Client.ActionV2.DeleteTarget(ctx, &action.DeleteTargetRequest{
|
||||
Id: id,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func (i *Instance) DeleteExecution(ctx context.Context, t *testing.T, cond *action.Condition) {
|
||||
_, err := i.Client.ActionV2beta.SetExecution(ctx, &action.SetExecutionRequest{
|
||||
_, err := i.Client.ActionV2.SetExecution(ctx, &action.SetExecutionRequest{
|
||||
Condition: cond,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func (i *Instance) SetExecution(ctx context.Context, t *testing.T, cond *action.Condition, targets []string) *action.SetExecutionResponse {
|
||||
target, err := i.Client.ActionV2beta.SetExecution(ctx, &action.SetExecutionRequest{
|
||||
target, err := i.Client.ActionV2.SetExecution(ctx, &action.SetExecutionRequest{
|
||||
Condition: cond,
|
||||
Targets: targets,
|
||||
})
|
||||
|
@@ -7,6 +7,7 @@ import (
|
||||
http_util "github.com/zitadel/zitadel/internal/api/http"
|
||||
"github.com/zitadel/zitadel/internal/api/ui/console"
|
||||
"github.com/zitadel/zitadel/internal/api/ui/login"
|
||||
"github.com/zitadel/zitadel/internal/command"
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
"github.com/zitadel/zitadel/internal/eventstore"
|
||||
"github.com/zitadel/zitadel/internal/eventstore/handler/v2"
|
||||
@@ -417,12 +418,14 @@ func (u *userNotifier) reduceSessionOTPSMSChallenged(event eventstore.Event) (*h
|
||||
if alreadyHandled {
|
||||
return nil
|
||||
}
|
||||
s, err := u.queries.SessionByID(ctx, true, e.Aggregate().ID, "", nil)
|
||||
|
||||
ctx, err = u.queries.Origin(ctx, e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ctx, err = u.queries.Origin(ctx, e)
|
||||
sessionWriteModel := command.NewSessionWriteModel(e.Aggregate().ID, e.Aggregate().InstanceID)
|
||||
err = u.queries.es.FilterToQueryReducer(ctx, sessionWriteModel)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -432,8 +435,8 @@ func (u *userNotifier) reduceSessionOTPSMSChallenged(event eventstore.Event) (*h
|
||||
return u.queue.Insert(ctx,
|
||||
¬ification.Request{
|
||||
Aggregate: e.Aggregate(),
|
||||
UserID: s.UserFactor.UserID,
|
||||
UserResourceOwner: s.UserFactor.ResourceOwner,
|
||||
UserID: sessionWriteModel.UserID,
|
||||
UserResourceOwner: sessionWriteModel.UserResourceOwner,
|
||||
TriggeredAtOrigin: http_util.DomainContext(ctx).Origin(),
|
||||
EventType: e.EventType,
|
||||
NotificationType: domain.NotificationTypeSms,
|
||||
|
@@ -1349,19 +1349,12 @@ func Test_userNotifier_reduceOTPSMSChallenged(t *testing.T) {
|
||||
test: func(ctrl *gomock.Controller, queries *mock.MockQueries, queue *mock.MockQueue) (f fields, a args, w want) {
|
||||
testCode := "testcode"
|
||||
_, code := cryptoValue(t, ctrl, testCode)
|
||||
queries.EXPECT().SessionByID(gomock.Any(), gomock.Any(), sessionID, gomock.Any(), nil).Return(&query.Session{
|
||||
ID: sessionID,
|
||||
ResourceOwner: instanceID,
|
||||
UserFactor: query.SessionUserFactor{
|
||||
UserID: userID,
|
||||
ResourceOwner: orgID,
|
||||
},
|
||||
}, nil)
|
||||
|
||||
queue.EXPECT().Insert(
|
||||
gomock.Any(),
|
||||
¬ification.Request{
|
||||
UserID: userID,
|
||||
UserResourceOwner: orgID,
|
||||
UserID: "", // Empty since no session events are provided
|
||||
UserResourceOwner: "", // Empty since no session events are provided
|
||||
TriggeredAtOrigin: eventOrigin,
|
||||
URLTemplate: "",
|
||||
Code: code,
|
||||
@@ -1387,11 +1380,15 @@ func Test_userNotifier_reduceOTPSMSChallenged(t *testing.T) {
|
||||
gomock.Any(),
|
||||
gomock.Any(),
|
||||
).Return(nil)
|
||||
|
||||
mockQuerier := es_repo_mock.NewMockQuerier(ctrl)
|
||||
mockQuerier.EXPECT().FilterToReducer(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
|
||||
|
||||
return fields{
|
||||
queries: queries,
|
||||
queue: queue,
|
||||
es: eventstore.NewEventstore(&eventstore.Config{
|
||||
Querier: es_repo_mock.NewRepo(t).ExpectFilterEvents().MockQuerier,
|
||||
Querier: mockQuerier,
|
||||
}),
|
||||
}, args{
|
||||
event: &session.OTPSMSChallengedEvent{
|
||||
@@ -1421,19 +1418,12 @@ func Test_userNotifier_reduceOTPSMSChallenged(t *testing.T) {
|
||||
IsPrimary: true,
|
||||
}},
|
||||
}, nil)
|
||||
queries.EXPECT().SessionByID(gomock.Any(), gomock.Any(), sessionID, gomock.Any(), nil).Return(&query.Session{
|
||||
ID: sessionID,
|
||||
ResourceOwner: instanceID,
|
||||
UserFactor: query.SessionUserFactor{
|
||||
UserID: userID,
|
||||
ResourceOwner: orgID,
|
||||
},
|
||||
}, nil)
|
||||
|
||||
queue.EXPECT().Insert(
|
||||
gomock.Any(),
|
||||
¬ification.Request{
|
||||
UserID: userID,
|
||||
UserResourceOwner: orgID,
|
||||
UserID: "", // Empty since no session events are provided
|
||||
UserResourceOwner: "", // Empty since no session events are provided
|
||||
TriggeredAtOrigin: fmt.Sprintf("%s://%s:%d", externalProtocol, instancePrimaryDomain, externalPort),
|
||||
URLTemplate: "",
|
||||
Code: code,
|
||||
@@ -1459,11 +1449,15 @@ func Test_userNotifier_reduceOTPSMSChallenged(t *testing.T) {
|
||||
gomock.Any(),
|
||||
gomock.Any(),
|
||||
).Return(nil)
|
||||
|
||||
mockQuerier := es_repo_mock.NewMockQuerier(ctrl)
|
||||
mockQuerier.EXPECT().FilterToReducer(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
|
||||
|
||||
return fields{
|
||||
queries: queries,
|
||||
queue: queue,
|
||||
es: eventstore.NewEventstore(&eventstore.Config{
|
||||
Querier: es_repo_mock.NewRepo(t).ExpectFilterEvents().MockQuerier,
|
||||
Querier: mockQuerier,
|
||||
}),
|
||||
}, args{
|
||||
event: &session.OTPSMSChallengedEvent{
|
||||
@@ -1484,19 +1478,11 @@ func Test_userNotifier_reduceOTPSMSChallenged(t *testing.T) {
|
||||
{
|
||||
name: "external code",
|
||||
test: func(ctrl *gomock.Controller, queries *mock.MockQueries, queue *mock.MockQueue) (f fields, a args, w want) {
|
||||
queries.EXPECT().SessionByID(gomock.Any(), gomock.Any(), sessionID, gomock.Any(), nil).Return(&query.Session{
|
||||
ID: sessionID,
|
||||
ResourceOwner: instanceID,
|
||||
UserFactor: query.SessionUserFactor{
|
||||
UserID: userID,
|
||||
ResourceOwner: orgID,
|
||||
},
|
||||
}, nil)
|
||||
queue.EXPECT().Insert(
|
||||
gomock.Any(),
|
||||
¬ification.Request{
|
||||
UserID: userID,
|
||||
UserResourceOwner: orgID,
|
||||
UserID: "", // Empty since no session events are provided
|
||||
UserResourceOwner: "", // Empty since no session events are provided
|
||||
TriggeredAtOrigin: eventOrigin,
|
||||
URLTemplate: "",
|
||||
Code: nil,
|
||||
@@ -1522,11 +1508,15 @@ func Test_userNotifier_reduceOTPSMSChallenged(t *testing.T) {
|
||||
gomock.Any(),
|
||||
gomock.Any(),
|
||||
).Return(nil)
|
||||
|
||||
mockQuerier := es_repo_mock.NewMockQuerier(ctrl)
|
||||
mockQuerier.EXPECT().FilterToReducer(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
|
||||
|
||||
return fields{
|
||||
queries: queries,
|
||||
queue: queue,
|
||||
es: eventstore.NewEventstore(&eventstore.Config{
|
||||
Querier: es_repo_mock.NewRepo(t).ExpectFilterEvents().MockQuerier,
|
||||
Querier: mockQuerier,
|
||||
}),
|
||||
}, args{
|
||||
event: &session.OTPSMSChallengedEvent{
|
||||
|
Reference in New Issue
Block a user