2021-03-19 10:12:56 +00:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
2023-08-23 11:55:52 +00:00
|
|
|
"github.com/muhlemmer/gu"
|
2021-03-19 10:12:56 +00:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"golang.org/x/text/language"
|
|
|
|
|
2022-04-26 23:01:45 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/domain"
|
|
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
|
|
"github.com/zitadel/zitadel/internal/eventstore/v1/models"
|
2023-08-23 11:55:52 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/repository/idp"
|
2022-04-26 23:01:45 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/repository/instance"
|
|
|
|
"github.com/zitadel/zitadel/internal/repository/org"
|
|
|
|
"github.com/zitadel/zitadel/internal/repository/user"
|
2023-12-08 14:30:55 +00:00
|
|
|
"github.com/zitadel/zitadel/internal/zerrors"
|
2021-03-19 10:12:56 +00:00
|
|
|
)
|
|
|
|
|
2021-11-02 09:08:47 +00:00
|
|
|
func TestCommandSide_BulkAddUserIDPLinks(t *testing.T) {
|
2021-03-19 10:12:56 +00:00
|
|
|
type fields struct {
|
|
|
|
eventstore *eventstore.Eventstore
|
|
|
|
}
|
|
|
|
type args struct {
|
|
|
|
ctx context.Context
|
|
|
|
userID string
|
|
|
|
resourceOwner string
|
2021-11-02 09:08:47 +00:00
|
|
|
links []*domain.UserIDPLink
|
2021-03-19 10:12:56 +00:00
|
|
|
}
|
|
|
|
type res struct {
|
2023-08-23 11:55:52 +00:00
|
|
|
err error
|
2021-03-19 10:12:56 +00:00
|
|
|
}
|
|
|
|
tests := []struct {
|
|
|
|
name string
|
|
|
|
fields fields
|
|
|
|
args args
|
|
|
|
res res
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "missing userid, invalid argument error",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: eventstoreExpect(
|
|
|
|
t,
|
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
|
|
|
userID: "",
|
2021-11-02 09:08:47 +00:00
|
|
|
links: []*domain.UserIDPLink{
|
2021-03-19 10:12:56 +00:00
|
|
|
{
|
|
|
|
IDPConfigID: "config1",
|
|
|
|
ExternalUserID: "externaluser1",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
resourceOwner: "org1",
|
|
|
|
},
|
|
|
|
res: res{
|
2023-12-08 14:30:55 +00:00
|
|
|
err: zerrors.ThrowInvalidArgument(nil, "COMMAND-03j8f", "Errors.IDMissing"),
|
2021-03-19 10:12:56 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "no external idps, invalid argument error",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: eventstoreExpect(
|
|
|
|
t,
|
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
|
|
|
userID: "user1",
|
|
|
|
resourceOwner: "org1",
|
|
|
|
},
|
|
|
|
res: res{
|
2023-12-08 14:30:55 +00:00
|
|
|
err: zerrors.ThrowInvalidArgument(nil, "COMMAND-Ek9s", "Errors.User.ExternalIDP.MinimumExternalIDPNeeded"),
|
2021-03-19 10:12:56 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "userID doesnt match aggregate id, invalid argument error",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: eventstoreExpect(
|
|
|
|
t,
|
2022-09-14 12:21:23 +00:00
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusher(
|
|
|
|
user.NewHumanAddedEvent(
|
|
|
|
context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"userName",
|
|
|
|
"firstName",
|
|
|
|
"lastName",
|
|
|
|
"nickName",
|
|
|
|
"displayName",
|
|
|
|
language.German,
|
|
|
|
domain.GenderFemale,
|
|
|
|
"email@Address.ch",
|
|
|
|
false,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2021-03-19 10:12:56 +00:00
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
|
|
|
userID: "user1",
|
|
|
|
resourceOwner: "org1",
|
2021-11-02 09:08:47 +00:00
|
|
|
links: []*domain.UserIDPLink{
|
2021-03-19 10:12:56 +00:00
|
|
|
{
|
|
|
|
ObjectRoot: models.ObjectRoot{
|
|
|
|
AggregateID: "user2",
|
|
|
|
},
|
|
|
|
IDPConfigID: "config1",
|
|
|
|
ExternalUserID: "externaluser1",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
res: res{
|
2023-12-08 14:30:55 +00:00
|
|
|
err: zerrors.ThrowInvalidArgument(nil, "COMMAND-33M0g", "Errors.IDMissing"),
|
2021-03-19 10:12:56 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "invalid external idp, invalid argument error",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: eventstoreExpect(
|
|
|
|
t,
|
2022-09-14 12:21:23 +00:00
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusher(
|
|
|
|
user.NewHumanAddedEvent(
|
|
|
|
context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"userName",
|
|
|
|
"firstName",
|
|
|
|
"lastName",
|
|
|
|
"nickName",
|
|
|
|
"displayName",
|
|
|
|
language.German,
|
|
|
|
domain.GenderFemale,
|
|
|
|
"email@Address.ch",
|
|
|
|
false,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2021-03-19 10:12:56 +00:00
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
|
|
|
userID: "user1",
|
|
|
|
resourceOwner: "org1",
|
2021-11-02 09:08:47 +00:00
|
|
|
links: []*domain.UserIDPLink{
|
2021-03-19 10:12:56 +00:00
|
|
|
{
|
|
|
|
ObjectRoot: models.ObjectRoot{
|
|
|
|
AggregateID: "user1",
|
|
|
|
},
|
|
|
|
IDPConfigID: "",
|
|
|
|
ExternalUserID: "externaluser1",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
res: res{
|
2023-12-08 14:30:55 +00:00
|
|
|
err: zerrors.ThrowInvalidArgument(nil, "COMMAND-6m9Kd", "Errors.User.ExternalIDP.Invalid"),
|
2021-03-19 10:12:56 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "config not existing, precondition error",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: eventstoreExpect(
|
|
|
|
t,
|
2022-08-29 15:09:07 +00:00
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusher(
|
|
|
|
user.NewHumanAddedEvent(
|
|
|
|
context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"userName",
|
|
|
|
"firstName",
|
|
|
|
"lastName",
|
|
|
|
"nickName",
|
|
|
|
"displayName",
|
|
|
|
language.German,
|
|
|
|
domain.GenderFemale,
|
|
|
|
"email@Address.ch",
|
|
|
|
false,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2021-03-19 10:12:56 +00:00
|
|
|
expectFilter(),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
|
|
|
userID: "user1",
|
|
|
|
resourceOwner: "org1",
|
2021-11-02 09:08:47 +00:00
|
|
|
links: []*domain.UserIDPLink{
|
2021-03-19 10:12:56 +00:00
|
|
|
{
|
|
|
|
ObjectRoot: models.ObjectRoot{
|
|
|
|
AggregateID: "user1",
|
|
|
|
},
|
|
|
|
IDPConfigID: "config1",
|
|
|
|
ExternalUserID: "externaluser1",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
res: res{
|
2023-12-08 14:30:55 +00:00
|
|
|
err: zerrors.ThrowPreconditionFailed(nil, "COMMAND-as02jin", "Errors.IDPConfig.NotExisting"),
|
2023-08-23 11:55:52 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "linking not allowed, precondition error",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: eventstoreExpect(
|
|
|
|
t,
|
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusher(
|
|
|
|
user.NewHumanAddedEvent(
|
|
|
|
context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"userName",
|
|
|
|
"firstName",
|
|
|
|
"lastName",
|
|
|
|
"nickName",
|
|
|
|
"displayName",
|
|
|
|
language.German,
|
|
|
|
domain.GenderFemale,
|
|
|
|
"email@Address.ch",
|
|
|
|
false,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusher(
|
|
|
|
org.NewIDPConfigAddedEvent(context.Background(),
|
|
|
|
&org.NewAggregate("org1").Aggregate,
|
|
|
|
"config1",
|
|
|
|
"name",
|
|
|
|
domain.IDPConfigTypeOIDC,
|
|
|
|
domain.IDPConfigStylingTypeUnspecified,
|
|
|
|
true,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
eventFromEventPusher(
|
|
|
|
org.NewIDPOIDCConfigAddedEvent(context.Background(),
|
|
|
|
&org.NewAggregate("org1").Aggregate,
|
|
|
|
"clientID",
|
|
|
|
"config1",
|
|
|
|
"issuer",
|
|
|
|
"authEndpoint",
|
|
|
|
"tokenEndpoint",
|
|
|
|
nil,
|
|
|
|
domain.OIDCMappingFieldUnspecified,
|
|
|
|
domain.OIDCMappingFieldUnspecified,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusher(
|
|
|
|
org.NewIDPConfigAddedEvent(context.Background(),
|
|
|
|
&org.NewAggregate("org1").Aggregate,
|
|
|
|
"config1",
|
|
|
|
"name",
|
|
|
|
domain.IDPConfigTypeOIDC,
|
|
|
|
domain.IDPConfigStylingTypeUnspecified,
|
|
|
|
true,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
eventFromEventPusher(
|
|
|
|
org.NewIDPOIDCConfigAddedEvent(context.Background(),
|
|
|
|
&org.NewAggregate("org1").Aggregate,
|
|
|
|
"clientID",
|
|
|
|
"config1",
|
|
|
|
"issuer",
|
|
|
|
"authEndpoint",
|
|
|
|
"tokenEndpoint",
|
|
|
|
nil,
|
|
|
|
domain.OIDCMappingFieldUnspecified,
|
|
|
|
domain.OIDCMappingFieldUnspecified,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
eventFromEventPusher(
|
|
|
|
func() eventstore.Command {
|
|
|
|
e, _ := org.NewOIDCIDPChangedEvent(context.Background(),
|
|
|
|
&org.NewAggregate("org1").Aggregate,
|
|
|
|
"config1",
|
|
|
|
[]idp.OIDCIDPChanges{
|
|
|
|
idp.ChangeOIDCOptions(idp.OptionChanges{IsLinkingAllowed: gu.Ptr(false)}),
|
|
|
|
},
|
|
|
|
)
|
|
|
|
return e
|
|
|
|
}(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
|
|
|
userID: "user1",
|
|
|
|
resourceOwner: "org1",
|
|
|
|
links: []*domain.UserIDPLink{
|
|
|
|
{
|
|
|
|
ObjectRoot: models.ObjectRoot{
|
|
|
|
AggregateID: "user1",
|
|
|
|
},
|
|
|
|
IDPConfigID: "config1",
|
|
|
|
DisplayName: "name",
|
|
|
|
ExternalUserID: "externaluser1",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
res: res{
|
2023-12-08 14:30:55 +00:00
|
|
|
err: zerrors.ThrowPreconditionFailed(nil, "COMMAND-Sfee2", "Errors.ExternalIDP.LinkingNotAllowed"),
|
2021-03-19 10:12:56 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "add external idp org config, ok",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: eventstoreExpect(
|
|
|
|
t,
|
2022-08-29 15:09:07 +00:00
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusher(
|
|
|
|
user.NewHumanAddedEvent(
|
|
|
|
context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"userName",
|
|
|
|
"firstName",
|
|
|
|
"lastName",
|
|
|
|
"nickName",
|
|
|
|
"displayName",
|
|
|
|
language.German,
|
|
|
|
domain.GenderFemale,
|
|
|
|
"email@Address.ch",
|
|
|
|
false,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2021-03-19 10:12:56 +00:00
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusher(
|
|
|
|
org.NewIDPConfigAddedEvent(context.Background(),
|
2022-04-20 14:59:37 +00:00
|
|
|
&org.NewAggregate("org1").Aggregate,
|
2021-03-19 10:12:56 +00:00
|
|
|
"config1",
|
|
|
|
"name",
|
|
|
|
domain.IDPConfigTypeOIDC,
|
|
|
|
domain.IDPConfigStylingTypeUnspecified,
|
2021-09-10 07:49:49 +00:00
|
|
|
true,
|
2021-03-19 10:12:56 +00:00
|
|
|
),
|
|
|
|
),
|
2023-08-23 11:55:52 +00:00
|
|
|
eventFromEventPusher(
|
|
|
|
org.NewIDPOIDCConfigAddedEvent(context.Background(),
|
|
|
|
&org.NewAggregate("org1").Aggregate,
|
|
|
|
"clientID",
|
|
|
|
"config1",
|
|
|
|
"issuer",
|
|
|
|
"authEndpoint",
|
|
|
|
"tokenEndpoint",
|
|
|
|
nil,
|
|
|
|
domain.OIDCMappingFieldUnspecified,
|
|
|
|
domain.OIDCMappingFieldUnspecified,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusher(
|
|
|
|
org.NewIDPConfigAddedEvent(context.Background(),
|
|
|
|
&org.NewAggregate("org1").Aggregate,
|
|
|
|
"config1",
|
|
|
|
"name",
|
|
|
|
domain.IDPConfigTypeOIDC,
|
|
|
|
domain.IDPConfigStylingTypeUnspecified,
|
|
|
|
true,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
eventFromEventPusher(
|
|
|
|
org.NewIDPOIDCConfigAddedEvent(context.Background(),
|
|
|
|
&org.NewAggregate("org1").Aggregate,
|
|
|
|
"clientID",
|
|
|
|
"config1",
|
|
|
|
"issuer",
|
|
|
|
"authEndpoint",
|
|
|
|
"tokenEndpoint",
|
|
|
|
nil,
|
|
|
|
domain.OIDCMappingFieldUnspecified,
|
|
|
|
domain.OIDCMappingFieldUnspecified,
|
|
|
|
),
|
|
|
|
),
|
2021-03-19 10:12:56 +00:00
|
|
|
),
|
|
|
|
expectPush(
|
2023-10-19 10:19:10 +00:00
|
|
|
user.NewUserIDPLinkAddedEvent(context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"config1",
|
|
|
|
"name",
|
|
|
|
"externaluser1",
|
|
|
|
),
|
2021-03-19 10:12:56 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
|
|
|
userID: "user1",
|
|
|
|
resourceOwner: "org1",
|
2021-11-02 09:08:47 +00:00
|
|
|
links: []*domain.UserIDPLink{
|
2021-03-19 10:12:56 +00:00
|
|
|
{
|
|
|
|
ObjectRoot: models.ObjectRoot{
|
|
|
|
AggregateID: "user1",
|
|
|
|
},
|
|
|
|
IDPConfigID: "config1",
|
|
|
|
DisplayName: "name",
|
|
|
|
ExternalUserID: "externaluser1",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
res: res{},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "add external idp iam config, ok",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: eventstoreExpect(
|
|
|
|
t,
|
2022-08-29 15:09:07 +00:00
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusher(
|
|
|
|
user.NewHumanAddedEvent(
|
|
|
|
context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"userName",
|
|
|
|
"firstName",
|
|
|
|
"lastName",
|
|
|
|
"nickName",
|
|
|
|
"displayName",
|
|
|
|
language.German,
|
|
|
|
domain.GenderFemale,
|
|
|
|
"email@Address.ch",
|
|
|
|
false,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2021-03-19 10:12:56 +00:00
|
|
|
expectFilter(
|
2023-08-23 11:55:52 +00:00
|
|
|
eventFromEventPusherWithInstanceID("instance1",
|
2022-03-24 16:21:34 +00:00
|
|
|
instance.NewIDPConfigAddedEvent(context.Background(),
|
2023-08-23 11:55:52 +00:00
|
|
|
&instance.NewAggregate("instance1").Aggregate,
|
|
|
|
"config1",
|
|
|
|
"name",
|
|
|
|
domain.IDPConfigTypeOIDC,
|
|
|
|
domain.IDPConfigStylingTypeUnspecified,
|
|
|
|
true,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
eventFromEventPusherWithInstanceID("instance1",
|
|
|
|
instance.NewIDPOIDCConfigAddedEvent(context.Background(),
|
|
|
|
&instance.NewAggregate("instance1").Aggregate,
|
|
|
|
"clientID",
|
|
|
|
"config1",
|
|
|
|
"issuer",
|
|
|
|
"authEndpoint",
|
|
|
|
"tokenEndpoint",
|
|
|
|
nil,
|
|
|
|
domain.OIDCMappingFieldUnspecified,
|
|
|
|
domain.OIDCMappingFieldUnspecified,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusherWithInstanceID("instance1",
|
|
|
|
instance.NewIDPConfigAddedEvent(context.Background(),
|
|
|
|
&instance.NewAggregate("instance1").Aggregate,
|
2021-03-19 10:12:56 +00:00
|
|
|
"config1",
|
|
|
|
"name",
|
|
|
|
domain.IDPConfigTypeOIDC,
|
|
|
|
domain.IDPConfigStylingTypeUnspecified,
|
2021-09-10 07:49:49 +00:00
|
|
|
true,
|
2021-03-19 10:12:56 +00:00
|
|
|
),
|
|
|
|
),
|
2023-08-23 11:55:52 +00:00
|
|
|
eventFromEventPusherWithInstanceID("instance1",
|
|
|
|
instance.NewIDPOIDCConfigAddedEvent(context.Background(),
|
|
|
|
&instance.NewAggregate("instance1").Aggregate,
|
|
|
|
"clientID",
|
|
|
|
"config1",
|
|
|
|
"issuer",
|
|
|
|
"authEndpoint",
|
|
|
|
"tokenEndpoint",
|
|
|
|
nil,
|
|
|
|
domain.OIDCMappingFieldUnspecified,
|
|
|
|
domain.OIDCMappingFieldUnspecified,
|
|
|
|
),
|
|
|
|
),
|
2021-03-19 10:12:56 +00:00
|
|
|
),
|
|
|
|
expectPush(
|
2023-10-19 10:19:10 +00:00
|
|
|
user.NewUserIDPLinkAddedEvent(context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"config1",
|
|
|
|
"name",
|
|
|
|
"externaluser1",
|
|
|
|
),
|
2021-03-19 10:12:56 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
|
|
|
userID: "user1",
|
|
|
|
resourceOwner: "org1",
|
2021-11-02 09:08:47 +00:00
|
|
|
links: []*domain.UserIDPLink{
|
2021-03-19 10:12:56 +00:00
|
|
|
{
|
|
|
|
ObjectRoot: models.ObjectRoot{
|
|
|
|
AggregateID: "user1",
|
|
|
|
},
|
|
|
|
IDPConfigID: "config1",
|
|
|
|
DisplayName: "name",
|
|
|
|
ExternalUserID: "externaluser1",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
res: res{},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
|
|
r := &Commands{
|
|
|
|
eventstore: tt.fields.eventstore,
|
|
|
|
}
|
2021-11-02 09:08:47 +00:00
|
|
|
err := r.BulkAddedUserIDPLinks(tt.args.ctx, tt.args.userID, tt.args.resourceOwner, tt.args.links)
|
2023-08-23 11:55:52 +00:00
|
|
|
assert.ErrorIs(t, err, tt.res.err)
|
2021-03-19 10:12:56 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-02 09:08:47 +00:00
|
|
|
func TestCommandSide_RemoveUserIDPLink(t *testing.T) {
|
2021-03-19 10:12:56 +00:00
|
|
|
type fields struct {
|
|
|
|
eventstore *eventstore.Eventstore
|
|
|
|
}
|
|
|
|
type args struct {
|
2021-11-02 09:08:47 +00:00
|
|
|
ctx context.Context
|
|
|
|
link *domain.UserIDPLink
|
2021-03-19 10:12:56 +00:00
|
|
|
}
|
|
|
|
type res struct {
|
|
|
|
want *domain.ObjectDetails
|
|
|
|
err func(error) bool
|
|
|
|
}
|
|
|
|
tests := []struct {
|
|
|
|
name string
|
|
|
|
fields fields
|
|
|
|
args args
|
|
|
|
res res
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "invalid idp, invalid argument error",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: eventstoreExpect(
|
|
|
|
t,
|
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
2021-11-02 09:08:47 +00:00
|
|
|
link: &domain.UserIDPLink{
|
2021-03-19 10:12:56 +00:00
|
|
|
ObjectRoot: models.ObjectRoot{
|
|
|
|
AggregateID: "user1",
|
|
|
|
},
|
|
|
|
IDPConfigID: "",
|
|
|
|
ExternalUserID: "externaluser1",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
res: res{
|
2023-12-08 14:30:55 +00:00
|
|
|
err: zerrors.IsErrorInvalidArgument,
|
2021-03-19 10:12:56 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "aggregate id missing, invalid argument error",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: eventstoreExpect(
|
|
|
|
t,
|
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
2021-11-02 09:08:47 +00:00
|
|
|
link: &domain.UserIDPLink{
|
2021-03-19 10:12:56 +00:00
|
|
|
IDPConfigID: "config1",
|
|
|
|
ExternalUserID: "externaluser1",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
res: res{
|
2023-12-08 14:30:55 +00:00
|
|
|
err: zerrors.IsErrorInvalidArgument,
|
2021-03-19 10:12:56 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "user removed, not found error",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: eventstoreExpect(
|
|
|
|
t,
|
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusher(
|
2021-11-02 09:08:47 +00:00
|
|
|
user.NewUserIDPLinkAddedEvent(context.Background(),
|
2021-03-19 10:12:56 +00:00
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"config1",
|
|
|
|
"name",
|
|
|
|
"externaluser1",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
eventFromEventPusher(
|
|
|
|
user.NewUserRemovedEvent(context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"username",
|
2021-08-24 07:22:21 +00:00
|
|
|
nil,
|
2021-03-19 10:12:56 +00:00
|
|
|
true,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
2021-11-02 09:08:47 +00:00
|
|
|
link: &domain.UserIDPLink{
|
2021-03-19 10:12:56 +00:00
|
|
|
ObjectRoot: models.ObjectRoot{
|
|
|
|
AggregateID: "user1",
|
|
|
|
},
|
|
|
|
IDPConfigID: "config1",
|
|
|
|
ExternalUserID: "externaluser1",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
res: res{
|
2023-12-08 14:30:55 +00:00
|
|
|
err: zerrors.IsNotFound,
|
2021-03-19 10:12:56 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "external idp not existing, not found error",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: eventstoreExpect(
|
|
|
|
t,
|
|
|
|
expectFilter(),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
2021-11-02 09:08:47 +00:00
|
|
|
link: &domain.UserIDPLink{
|
2021-03-19 10:12:56 +00:00
|
|
|
ObjectRoot: models.ObjectRoot{
|
|
|
|
AggregateID: "user1",
|
|
|
|
},
|
|
|
|
IDPConfigID: "config1",
|
|
|
|
ExternalUserID: "externaluser1",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
res: res{
|
2023-12-08 14:30:55 +00:00
|
|
|
err: zerrors.IsNotFound,
|
2021-03-19 10:12:56 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "remove external idp, ok",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: eventstoreExpect(
|
|
|
|
t,
|
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusher(
|
2021-11-02 09:08:47 +00:00
|
|
|
user.NewUserIDPLinkAddedEvent(context.Background(),
|
2021-03-19 10:12:56 +00:00
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"config1",
|
|
|
|
"name",
|
|
|
|
"externaluser1",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
expectPush(
|
2023-10-19 10:19:10 +00:00
|
|
|
user.NewUserIDPLinkRemovedEvent(context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"config1",
|
|
|
|
"externaluser1",
|
|
|
|
),
|
2021-03-19 10:12:56 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
2021-11-02 09:08:47 +00:00
|
|
|
link: &domain.UserIDPLink{
|
2021-03-19 10:12:56 +00:00
|
|
|
ObjectRoot: models.ObjectRoot{
|
|
|
|
AggregateID: "user1",
|
|
|
|
},
|
|
|
|
IDPConfigID: "config1",
|
|
|
|
ExternalUserID: "externaluser1",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
res: res{
|
|
|
|
want: &domain.ObjectDetails{
|
|
|
|
ResourceOwner: "org1",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
|
|
r := &Commands{
|
|
|
|
eventstore: tt.fields.eventstore,
|
|
|
|
}
|
2021-11-02 09:08:47 +00:00
|
|
|
got, err := r.RemoveUserIDPLink(tt.args.ctx, tt.args.link)
|
2021-03-19 10:12:56 +00:00
|
|
|
if tt.res.err == nil {
|
|
|
|
assert.NoError(t, err)
|
|
|
|
}
|
|
|
|
if tt.res.err != nil && !tt.res.err(err) {
|
|
|
|
t.Errorf("got wrong err: %v ", err)
|
|
|
|
}
|
|
|
|
if tt.res.err == nil {
|
|
|
|
assert.Equal(t, tt.res.want, got)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCommandSide_ExternalLoginCheck(t *testing.T) {
|
|
|
|
type fields struct {
|
|
|
|
eventstore *eventstore.Eventstore
|
|
|
|
}
|
|
|
|
type args struct {
|
|
|
|
ctx context.Context
|
|
|
|
orgID string
|
|
|
|
userID string
|
|
|
|
authRequest *domain.AuthRequest
|
|
|
|
}
|
|
|
|
type res struct {
|
|
|
|
err func(error) bool
|
|
|
|
}
|
|
|
|
tests := []struct {
|
|
|
|
name string
|
|
|
|
fields fields
|
|
|
|
args args
|
|
|
|
res res
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "userid missing, invalid argument error",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: eventstoreExpect(
|
|
|
|
t,
|
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
|
|
|
orgID: "org1",
|
|
|
|
userID: "",
|
|
|
|
},
|
|
|
|
res: res{
|
2023-12-08 14:30:55 +00:00
|
|
|
err: zerrors.IsErrorInvalidArgument,
|
2021-03-19 10:12:56 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "user removed, not found error",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: eventstoreExpect(
|
|
|
|
t,
|
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusher(
|
2021-11-02 09:08:47 +00:00
|
|
|
user.NewUserIDPLinkAddedEvent(context.Background(),
|
2021-03-19 10:12:56 +00:00
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"config1",
|
|
|
|
"name",
|
|
|
|
"externaluser1",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
eventFromEventPusher(
|
|
|
|
user.NewUserRemovedEvent(context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"username",
|
2021-08-24 07:22:21 +00:00
|
|
|
nil,
|
2021-03-19 10:12:56 +00:00
|
|
|
true,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
|
|
|
orgID: "org1",
|
|
|
|
userID: "user1",
|
|
|
|
},
|
|
|
|
res: res{
|
2023-12-08 14:30:55 +00:00
|
|
|
err: zerrors.IsPreconditionFailed,
|
2021-03-19 10:12:56 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "external login check, ok",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: eventstoreExpect(
|
|
|
|
t,
|
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusher(
|
|
|
|
user.NewHumanAddedEvent(context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"username",
|
|
|
|
"firstname",
|
|
|
|
"lastname",
|
|
|
|
"nickname",
|
|
|
|
"displayname",
|
|
|
|
language.German,
|
|
|
|
domain.GenderUnspecified,
|
|
|
|
"email@test.ch",
|
|
|
|
true,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
expectPush(
|
2023-10-19 10:19:10 +00:00
|
|
|
user.NewUserIDPCheckSucceededEvent(context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
&user.AuthRequestInfo{
|
|
|
|
ID: "request1",
|
|
|
|
UserAgentID: "useragent1",
|
|
|
|
SelectedIDPConfigID: "config1",
|
|
|
|
},
|
|
|
|
),
|
2021-03-19 10:12:56 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
|
|
|
orgID: "org1",
|
|
|
|
userID: "user1",
|
|
|
|
authRequest: &domain.AuthRequest{
|
|
|
|
ID: "request1",
|
|
|
|
AgentID: "useragent1",
|
|
|
|
SelectedIDPConfigID: "config1",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
res: res{},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
|
|
r := &Commands{
|
|
|
|
eventstore: tt.fields.eventstore,
|
|
|
|
}
|
2021-11-02 09:08:47 +00:00
|
|
|
err := r.UserIDPLoginChecked(tt.args.ctx, tt.args.orgID, tt.args.userID, tt.args.authRequest)
|
2021-03-19 10:12:56 +00:00
|
|
|
if tt.res.err == nil {
|
|
|
|
assert.NoError(t, err)
|
|
|
|
}
|
|
|
|
if tt.res.err != nil && !tt.res.err(err) {
|
|
|
|
t.Errorf("got wrong err: %v ", err)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2023-08-04 09:35:36 +00:00
|
|
|
|
|
|
|
func TestCommandSide_MigrateUserIDP(t *testing.T) {
|
|
|
|
type fields struct {
|
|
|
|
eventstore func(t *testing.T) *eventstore.Eventstore
|
|
|
|
}
|
|
|
|
type args struct {
|
|
|
|
ctx context.Context
|
|
|
|
userID string
|
|
|
|
orgID string
|
|
|
|
idpConfigID string
|
|
|
|
previousID string
|
|
|
|
newID string
|
|
|
|
}
|
|
|
|
type res struct {
|
|
|
|
err error
|
|
|
|
}
|
|
|
|
tests := []struct {
|
|
|
|
name string
|
|
|
|
fields fields
|
|
|
|
args args
|
|
|
|
res res
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "userid missing, invalid argument error",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: expectEventstore(),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
|
|
|
userID: "",
|
|
|
|
orgID: "org1",
|
|
|
|
idpConfigID: "idpConfig1",
|
|
|
|
previousID: "previousID",
|
|
|
|
newID: "newID",
|
|
|
|
},
|
|
|
|
res: res{
|
2023-12-08 14:30:55 +00:00
|
|
|
err: zerrors.ThrowInvalidArgument(nil, "COMMAND-Sn3l1", "Errors.IDMissing"),
|
2023-08-04 09:35:36 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "idp link not active, precondition failed error",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: expectEventstore(
|
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusher(
|
|
|
|
user.NewUserIDPLinkAddedEvent(context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"idpConfig1",
|
|
|
|
"displayName",
|
|
|
|
"externalUserID",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
|
|
|
userID: "user1",
|
|
|
|
orgID: "org1",
|
|
|
|
idpConfigID: "idpConfig1",
|
|
|
|
previousID: "previousID",
|
|
|
|
newID: "newID",
|
|
|
|
},
|
|
|
|
res: res{
|
2023-12-08 14:30:55 +00:00
|
|
|
err: zerrors.ThrowPreconditionFailed(nil, "COMMAND-KJH2o", "Errors.User.ExternalIDP.NotFound"),
|
2023-08-04 09:35:36 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "external login check, ok",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: expectEventstore(
|
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusher(
|
|
|
|
user.NewUserIDPLinkAddedEvent(context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"idpConfig1",
|
|
|
|
"displayName",
|
|
|
|
"previousID",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
expectPush(
|
2023-10-19 10:19:10 +00:00
|
|
|
user.NewUserIDPExternalIDMigratedEvent(context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"idpConfig1",
|
|
|
|
"previousID",
|
|
|
|
"newID",
|
|
|
|
),
|
2023-08-04 09:35:36 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
|
|
|
userID: "user1",
|
|
|
|
orgID: "org1",
|
|
|
|
idpConfigID: "idpConfig1",
|
|
|
|
previousID: "previousID",
|
|
|
|
newID: "newID",
|
|
|
|
},
|
|
|
|
res: res{},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
|
|
r := &Commands{
|
|
|
|
eventstore: tt.fields.eventstore(t),
|
|
|
|
}
|
|
|
|
err := r.MigrateUserIDP(tt.args.ctx, tt.args.userID, tt.args.orgID, tt.args.idpConfigID, tt.args.previousID, tt.args.newID)
|
|
|
|
assert.ErrorIs(t, err, tt.res.err)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2023-12-08 17:22:07 +00:00
|
|
|
|
|
|
|
func TestCommandSide_UpdateUserIDPLinkUsername(t *testing.T) {
|
|
|
|
type fields struct {
|
|
|
|
eventstore func(t *testing.T) *eventstore.Eventstore
|
|
|
|
}
|
|
|
|
type args struct {
|
|
|
|
ctx context.Context
|
|
|
|
userID string
|
|
|
|
orgID string
|
|
|
|
idpConfigID string
|
|
|
|
externalUserID string
|
|
|
|
newUsername string
|
|
|
|
}
|
|
|
|
type res struct {
|
|
|
|
err error
|
|
|
|
}
|
|
|
|
tests := []struct {
|
|
|
|
name string
|
|
|
|
fields fields
|
|
|
|
args args
|
|
|
|
res res
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "userid missing, invalid argument error",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: expectEventstore(),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
|
|
|
userID: "",
|
|
|
|
orgID: "org1",
|
|
|
|
idpConfigID: "idpConfig1",
|
|
|
|
externalUserID: "externalUserID",
|
|
|
|
newUsername: "newUsername",
|
|
|
|
},
|
|
|
|
res: res{
|
|
|
|
err: zerrors.ThrowInvalidArgument(nil, "COMMAND-SFegz", "Errors.IDMissing"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "idp link not active, precondition failed error",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: expectEventstore(
|
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusher(
|
|
|
|
user.NewUserIDPLinkAddedEvent(context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"idpConfig1",
|
|
|
|
"displayName",
|
|
|
|
"externalUserID",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
|
|
|
userID: "user1",
|
|
|
|
orgID: "org1",
|
|
|
|
idpConfigID: "idpConfig1",
|
|
|
|
externalUserID: "otherID",
|
|
|
|
newUsername: "newUsername",
|
|
|
|
},
|
|
|
|
res: res{
|
|
|
|
err: zerrors.ThrowPreconditionFailed(nil, "COMMAND-DGhre", "Errors.User.ExternalIDP.NotFound"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "external username not changed, ok",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: expectEventstore(
|
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusher(
|
|
|
|
user.NewUserIDPLinkAddedEvent(context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"idpConfig1",
|
|
|
|
"displayName",
|
|
|
|
"externalUserID",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
|
|
|
userID: "user1",
|
|
|
|
orgID: "org1",
|
|
|
|
idpConfigID: "idpConfig1",
|
|
|
|
externalUserID: "externalUserID",
|
|
|
|
newUsername: "displayName",
|
|
|
|
},
|
|
|
|
res: res{},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "external username update, ok",
|
|
|
|
fields: fields{
|
|
|
|
eventstore: expectEventstore(
|
|
|
|
expectFilter(
|
|
|
|
eventFromEventPusher(
|
|
|
|
user.NewUserIDPLinkAddedEvent(context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"idpConfig1",
|
|
|
|
"displayName",
|
|
|
|
"externalUserID",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
expectPush(
|
|
|
|
user.NewUserIDPExternalUsernameEvent(context.Background(),
|
|
|
|
&user.NewAggregate("user1", "org1").Aggregate,
|
|
|
|
"idpConfig1",
|
|
|
|
"externalUserID",
|
|
|
|
"newUsername",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
},
|
|
|
|
args: args{
|
|
|
|
ctx: context.Background(),
|
|
|
|
userID: "user1",
|
|
|
|
orgID: "org1",
|
|
|
|
idpConfigID: "idpConfig1",
|
|
|
|
externalUserID: "externalUserID",
|
|
|
|
newUsername: "newUsername",
|
|
|
|
},
|
|
|
|
res: res{},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
|
|
r := &Commands{
|
|
|
|
eventstore: tt.fields.eventstore(t),
|
|
|
|
}
|
|
|
|
err := r.UpdateUserIDPLinkUsername(tt.args.ctx, tt.args.userID, tt.args.orgID, tt.args.idpConfigID, tt.args.externalUserID, tt.args.newUsername)
|
|
|
|
assert.ErrorIs(t, err, tt.res.err)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|