feat: add assets to eventstore and event (#1674)

* fix: add assets to eventstore and event

* fix: project member, grant member, app changed tests

* fix: asset migrations

* feat: add asset tests

* feat: add asset tests

* Update internal/eventstore/repository/repository.go

Co-authored-by: Livio Amstutz <[email protected]>

* feat: add asset tests

Co-authored-by: Livio Amstutz <[email protected]>
This commit is contained in:
Fabi
2021-04-27 12:58:18 +02:00
committed by GitHub
co-authored by Livio Amstutz
parent eaf966e3d2
commit f51f0ede5c
102 changed files with 1079 additions and 34 deletions
+2
View File
@@ -88,6 +88,7 @@ func TestCommandSide_AddDefaultIDPConfig(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(idpconfig.NewAddIDPConfigNameUniqueConstraint("name1", "IAM")),
),
),
@@ -234,6 +235,7 @@ func TestCommandSide_ChangeDefaultIDPConfig(t *testing.T) {
newDefaultIDPConfigChangedEvent(context.Background(), "config1", "name1", "name2", domain.IDPConfigStylingTypeUnspecified),
),
},
nil,
uniqueConstraintsFromEventConstraint(idpconfig.NewRemoveIDPConfigNameUniqueConstraint("name1", "IAM")),
uniqueConstraintsFromEventConstraint(idpconfig.NewAddIDPConfigNameUniqueConstraint("name2", "IAM")),
),
@@ -226,6 +226,7 @@ func TestCommandSide_ChangeDefaultIDPOIDCConfig(t *testing.T) {
),
),
},
nil,
),
),
secretCrypto: crypto.CreateMockEncryptionAlg(gomock.NewController(t)),
+4
View File
@@ -180,6 +180,7 @@ func TestCommandSide_AddIAMMember(t *testing.T) {
[]string{"IAM_OWNER"}...,
)),
},
nil,
uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("IAM", "user1")),
),
),
@@ -230,6 +231,7 @@ func TestCommandSide_AddIAMMember(t *testing.T) {
[]string{"IAM_OWNER"}...,
)),
},
nil,
uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("IAM", "user1")),
),
),
@@ -408,6 +410,7 @@ func TestCommandSide_ChangeIAMMember(t *testing.T) {
[]string{"IAM_OWNER", "IAM_OWNER_VIEWER"}...,
)),
},
nil,
),
),
zitadelRoles: []authz.RoleMapping{
@@ -528,6 +531,7 @@ func TestCommandSide_RemoveIAMMember(t *testing.T) {
"user1",
)),
},
nil,
uniqueConstraintsFromEventConstraint(member.NewRemoveMemberUniqueConstraint("IAM", "user1")),
),
),
@@ -95,6 +95,7 @@ func TestCommandSide_AddDefaultLabelPolicy(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -243,6 +244,7 @@ func TestCommandSide_ChangeDefaultLabelPolicy(t *testing.T) {
newDefaultLabelPolicyChangedEvent(context.Background(), "primary-color-change", "secondary-color-change", false),
),
},
nil,
),
),
},
+10
View File
@@ -83,6 +83,7 @@ func TestCommandSide_AddDefaultLoginPolicy(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -223,6 +224,7 @@ func TestCommandSide_ChangeDefaultLoginPolicy(t *testing.T) {
newDefaultLoginPolicyChangedEvent(context.Background(), false, false, false, false, domain.PasswordlessTypeNotAllowed),
),
},
nil,
),
),
},
@@ -392,6 +394,7 @@ func TestCommandSide_AddIDPProviderDefaultLoginPolicy(t *testing.T) {
"config1"),
),
},
nil,
),
),
},
@@ -555,6 +558,7 @@ func TestCommandSide_RemoveIDPProviderDefaultLoginPolicy(t *testing.T) {
"config1"),
),
},
nil,
),
),
},
@@ -601,6 +605,7 @@ func TestCommandSide_RemoveIDPProviderDefaultLoginPolicy(t *testing.T) {
"config1"),
),
},
nil,
),
),
},
@@ -666,6 +671,7 @@ func TestCommandSide_RemoveIDPProviderDefaultLoginPolicy(t *testing.T) {
&user.NewAggregate("user1", "org1").Aggregate,
"config1", "externaluser1")),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewRemoveExternalIDPUniqueConstraint("config1", "externaluser1")),
),
),
@@ -781,6 +787,7 @@ func TestCommandSide_AddSecondFactorDefaultLoginPolicy(t *testing.T) {
domain.SecondFactorTypeOTP),
),
},
nil,
),
),
},
@@ -913,6 +920,7 @@ func TestCommandSide_RemoveSecondFactorDefaultLoginPolicy(t *testing.T) {
domain.SecondFactorTypeOTP),
),
},
nil,
),
),
},
@@ -1016,6 +1024,7 @@ func TestCommandSide_AddMultiFactorDefaultLoginPolicy(t *testing.T) {
domain.MultiFactorTypeU2FWithPIN),
),
},
nil,
),
),
},
@@ -1148,6 +1157,7 @@ func TestCommandSide_RemoveMultiFactorDefaultLoginPolicy(t *testing.T) {
domain.MultiFactorTypeU2FWithPIN),
),
},
nil,
),
),
},
@@ -86,6 +86,7 @@ func TestCommandSide_AddDefaultMailTemplatePolicy(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -220,6 +221,7 @@ func TestCommandSide_ChangeDefaultMailTemplatePolicy(t *testing.T) {
newDefaultMailTemplatePolicyChangedEvent(context.Background(), []byte("template-change")),
),
},
nil,
),
),
},
@@ -107,6 +107,7 @@ func TestCommandSide_AddDefaultMailTextPolicy(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(policy.NewAddMailTextUniqueConstraint("IAM", "mail-text-type", "de")),
),
),
@@ -294,6 +295,7 @@ func TestCommandSide_ChangeDefaultMailTextPolicy(t *testing.T) {
"button-text-change"),
),
},
nil,
),
),
},
@@ -71,6 +71,7 @@ func TestCommandSide_AddDefaultOrgIAMPolicy(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -190,6 +191,7 @@ func TestCommandSide_ChangeDefaultOrgIAMPolicy(t *testing.T) {
newDefaultOrgIAMPolicyChangedEvent(context.Background(), false),
),
},
nil,
),
),
},
@@ -74,6 +74,7 @@ func TestCommandSide_AddDefaultPasswordAgePolicy(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -199,6 +200,7 @@ func TestCommandSide_ChangeDefaultPasswordAgePolicy(t *testing.T) {
newDefaultPasswordAgePolicyChangedEvent(context.Background(), 125, 5),
),
},
nil,
),
),
},
@@ -98,6 +98,7 @@ func TestCommandSide_AddDefaultPasswordComplexityPolicy(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -256,6 +257,7 @@ func TestCommandSide_ChangeDefaultPasswordComplexityPolicy(t *testing.T) {
newDefaultPasswordComplexityPolicyChangedEvent(context.Background(), 10, false, false, false, false),
),
},
nil,
),
),
},
@@ -74,6 +74,7 @@ func TestCommandSide_AddDefaultPasswordLockoutPolicy(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -199,6 +200,7 @@ func TestCommandSide_ChangeDefaultPasswordLockoutPolicy(t *testing.T) {
newDefaultPasswordLockoutPolicyChangedEvent(context.Background(), 20, false),
),
},
nil,
),
),
},
+4 -4
View File
@@ -103,15 +103,15 @@ func (repo *testRepo) LatestSequence(ctx context.Context, queryFactory *reposito
return repo.sequence, nil
}
func expectPush(events []*repository.Event, uniqueConstraints ...*repository.UniqueConstraint) expect {
func expectPush(events []*repository.Event, assets []*repository.Asset, uniqueConstraints ...*repository.UniqueConstraint) expect {
return func(m *mock.MockRepository) {
m.ExpectPush(events, uniqueConstraints...)
m.ExpectPush(events, assets, uniqueConstraints...)
}
}
func expectPushFailed(err error, events []*repository.Event, uniqueConstraints ...*repository.UniqueConstraint) expect {
func expectPushFailed(err error, events []*repository.Event, assets []*repository.Asset, uniqueConstraints ...*repository.UniqueConstraint) expect {
return func(m *mock.MockRepository) {
m.ExpectPushFailed(err, events, uniqueConstraints...)
m.ExpectPushFailed(err, events, assets, uniqueConstraints...)
}
}
+10
View File
@@ -108,6 +108,7 @@ func TestCommandSide_AddOrgDomain(t *testing.T) {
"domain.ch",
)),
},
nil,
),
),
},
@@ -322,6 +323,7 @@ func TestCommandSide_GenerateOrgDomainValidation(t *testing.T) {
},
)),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -374,6 +376,7 @@ func TestCommandSide_GenerateOrgDomainValidation(t *testing.T) {
},
)),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -618,6 +621,7 @@ func TestCommandSide_ValidateOrgDomain(t *testing.T) {
"domain.ch",
)),
},
nil,
),
),
alg: crypto.CreateMockEncryptionAlg(gomock.NewController(t)),
@@ -676,6 +680,7 @@ func TestCommandSide_ValidateOrgDomain(t *testing.T) {
"domain.ch",
)),
},
nil,
uniqueConstraintsFromEventConstraint(org.NewAddOrgDomainUniqueConstraint("domain.ch")),
),
),
@@ -738,6 +743,7 @@ func TestCommandSide_ValidateOrgDomain(t *testing.T) {
"domain.ch",
)),
},
nil,
uniqueConstraintsFromEventConstraint(org.NewAddOrgDomainUniqueConstraint("domain.ch")),
),
),
@@ -827,6 +833,7 @@ func TestCommandSide_ValidateOrgDomain(t *testing.T) {
false,
)),
},
nil,
uniqueConstraintsFromEventConstraint(org.NewAddOrgDomainUniqueConstraint("domain.ch")),
uniqueConstraintsFromEventConstraint(user.NewRemoveUsernameUniqueConstraint("[email protected]", "org2", false)),
uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("[email protected]", "org2", false)),
@@ -1027,6 +1034,7 @@ func TestCommandSide_SetPrimaryDomain(t *testing.T) {
"domain.ch",
)),
},
nil,
),
),
},
@@ -1220,6 +1228,7 @@ func TestCommandSide_RemoveOrgDomain(t *testing.T) {
"domain.ch", false,
)),
},
nil,
),
),
},
@@ -1270,6 +1279,7 @@ func TestCommandSide_RemoveOrgDomain(t *testing.T) {
"domain.ch", true,
)),
},
nil,
uniqueConstraintsFromEventConstraint(org.NewRemoveOrgDomainUniqueConstraint("domain.ch")),
),
),
+6
View File
@@ -175,6 +175,7 @@ func TestCommandSide_SetOrgFeatures(t *testing.T) {
newFeaturesSetEvent(context.Background(), "org1", "Test", domain.FeaturesStateActive, time.Hour),
),
},
nil,
),
),
iamDomain: "iam-domain",
@@ -308,6 +309,7 @@ func TestCommandSide_SetOrgFeatures(t *testing.T) {
newFeaturesSetEvent(context.Background(), "org1", "Test", domain.FeaturesStateActive, time.Hour),
),
},
nil,
uniqueConstraintsFromEventConstraint(org.NewRemoveOrgDomainUniqueConstraint("test1")),
),
),
@@ -452,6 +454,7 @@ func TestCommandSide_SetOrgFeatures(t *testing.T) {
newFeaturesSetEvent(context.Background(), "org1", "Test", domain.FeaturesStateActive, time.Hour),
),
},
nil,
uniqueConstraintsFromEventConstraint(org.NewRemoveOrgDomainUniqueConstraint("test1")),
),
),
@@ -606,6 +609,7 @@ func TestCommandSide_SetOrgFeatures(t *testing.T) {
newFeaturesSetEvent(context.Background(), "org1", "Test", domain.FeaturesStateActive, time.Hour),
),
},
nil,
uniqueConstraintsFromEventConstraint(org.NewRemoveOrgDomainUniqueConstraint("test1")),
),
),
@@ -802,6 +806,7 @@ func TestCommandSide_SetOrgFeatures(t *testing.T) {
newFeaturesSetEvent(context.Background(), "org1", "Test", domain.FeaturesStateActive, time.Hour),
),
},
nil,
),
),
iamDomain: "iam-domain",
@@ -984,6 +989,7 @@ func TestCommandSide_RemoveOrgFeatures(t *testing.T) {
org.NewFeaturesRemovedEvent(context.Background(), &org.NewAggregate("org1", "org1").Aggregate),
),
},
nil,
),
),
iamDomain: "iam-domain",
+2
View File
@@ -116,6 +116,7 @@ func TestCommandSide_AddIDPConfig(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(idpconfig.NewAddIDPConfigNameUniqueConstraint("name1", "org1")),
),
),
@@ -282,6 +283,7 @@ func TestCommandSide_ChangeIDPConfig(t *testing.T) {
newIDPConfigChangedEvent(context.Background(), "org1", "config1", "name1", "name2", domain.IDPConfigStylingTypeUnspecified),
),
},
nil,
uniqueConstraintsFromEventConstraint(idpconfig.NewRemoveIDPConfigNameUniqueConstraint("name1", "org1")),
uniqueConstraintsFromEventConstraint(idpconfig.NewAddIDPConfigNameUniqueConstraint("name2", "org1")),
),
@@ -249,6 +249,7 @@ func TestCommandSide_ChangeIDPOIDCConfig(t *testing.T) {
),
),
},
nil,
),
),
secretCrypto: crypto.CreateMockEncryptionAlg(gomock.NewController(t)),
+4
View File
@@ -196,6 +196,7 @@ func TestCommandSide_AddOrgMember(t *testing.T) {
[]string{"ORG_OWNER"}...,
)),
},
nil,
uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("org1", "user1")),
),
),
@@ -249,6 +250,7 @@ func TestCommandSide_AddOrgMember(t *testing.T) {
[]string{"ORG_OWNER"}...,
)),
},
nil,
uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("org1", "user1")),
),
),
@@ -443,6 +445,7 @@ func TestCommandSide_ChangeOrgMember(t *testing.T) {
[]string{"ORG_OWNER", "ORG_OWNER_VIEWER"}...,
)),
},
nil,
),
),
zitadelRoles: []authz.RoleMapping{
@@ -589,6 +592,7 @@ func TestCommandSide_RemoveOrgMember(t *testing.T) {
"user1",
)),
},
nil,
uniqueConstraintsFromEventConstraint(member.NewRemoveMemberUniqueConstraint("project1", "user1")),
),
),
@@ -118,6 +118,7 @@ func TestCommandSide_AddLabelPolicy(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -289,6 +290,7 @@ func TestCommandSide_ChangeLabelPolicy(t *testing.T) {
newLabelPolicyChangedEvent(context.Background(), "org1", "primary-color-change", "secondary-color-change", false),
),
},
nil,
),
),
},
@@ -402,6 +404,7 @@ func TestCommandSide_RemoveLabelPolicy(t *testing.T) {
&org.NewAggregate("org1", "org1").Aggregate),
),
},
nil,
),
),
},
+11
View File
@@ -158,6 +158,7 @@ func TestCommandSide_AddLoginPolicy(t *testing.T) {
),
),
},
nil,
),
),
tokenVerifier: GetMockVerifier(t, domain.FeatureLoginPolicyUsernameLogin),
@@ -401,6 +402,7 @@ func TestCommandSide_ChangeLoginPolicy(t *testing.T) {
newLoginPolicyChangedEvent(context.Background(), "org1", false, false, false, false, domain.PasswordlessTypeNotAllowed),
),
},
nil,
),
),
tokenVerifier: GetMockVerifier(t, domain.FeatureLoginPolicyUsernameLogin),
@@ -523,6 +525,7 @@ func TestCommandSide_RemoveLoginPolicy(t *testing.T) {
&org.NewAggregate("org1", "org1").Aggregate),
),
},
nil,
),
),
},
@@ -707,6 +710,7 @@ func TestCommandSide_AddIDPProviderLoginPolicy(t *testing.T) {
domain.IdentityProviderTypeOrg),
),
},
nil,
),
),
},
@@ -901,6 +905,7 @@ func TestCommandSide_RemoveIDPProviderLoginPolicy(t *testing.T) {
"config1"),
),
},
nil,
),
),
},
@@ -951,6 +956,7 @@ func TestCommandSide_RemoveIDPProviderLoginPolicy(t *testing.T) {
"config1"),
),
},
nil,
),
),
},
@@ -1020,6 +1026,7 @@ func TestCommandSide_RemoveIDPProviderLoginPolicy(t *testing.T) {
&user.NewAggregate("user1", "org1").Aggregate,
"config1", "externaluser1")),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewRemoveExternalIDPUniqueConstraint("config1", "externaluser1")),
),
),
@@ -1153,6 +1160,7 @@ func TestCommandSide_AddSecondFactorLoginPolicy(t *testing.T) {
domain.SecondFactorTypeOTP),
),
},
nil,
),
),
},
@@ -1302,6 +1310,7 @@ func TestCommandSide_RemoveSecondFactoroginPolicy(t *testing.T) {
domain.SecondFactorTypeOTP),
),
},
nil,
),
),
},
@@ -1420,6 +1429,7 @@ func TestCommandSide_AddMultiFactorLoginPolicy(t *testing.T) {
domain.MultiFactorTypeU2FWithPIN),
),
},
nil,
),
),
},
@@ -1569,6 +1579,7 @@ func TestCommandSide_RemoveMultiFactorLoginPolicy(t *testing.T) {
domain.MultiFactorTypeU2FWithPIN),
),
},
nil,
),
),
},
@@ -92,6 +92,7 @@ func TestCommandSide_AddMailTemplate(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -232,6 +233,7 @@ func TestCommandSide_ChangeMailTemplate(t *testing.T) {
newMailTemplateChangedEvent(context.Background(), "org1", "template2"),
),
},
nil,
),
),
},
@@ -340,6 +342,7 @@ func TestCommandSide_RemoveMailTemplate(t *testing.T) {
&org.NewAggregate("org1", "org1").Aggregate),
),
},
nil,
),
),
},
@@ -160,6 +160,7 @@ func TestCommandSide_AddMailText(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(policy.NewAddMailTextUniqueConstraint("org1", "mail-text-type", "de")),
),
),
@@ -376,6 +377,7 @@ func TestCommandSide_ChangeMailText(t *testing.T) {
"button-text-change"),
),
},
nil,
),
),
},
@@ -512,6 +514,7 @@ func TestCommandSide_RemoveMailText(t *testing.T) {
"de"),
),
},
nil,
uniqueConstraintsFromEventConstraint(policy.NewRemoveMailTextUniqueConstraint("org1", "mail-text-type", "de")),
),
),
@@ -92,6 +92,7 @@ func TestCommandSide_AddOrgIAMPolicy(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -232,6 +233,7 @@ func TestCommandSide_ChangeOrgIAMPolicy(t *testing.T) {
newOrgIAMPolicyChangedEvent(context.Background(), "org1", false),
),
},
nil,
),
),
},
@@ -340,6 +342,7 @@ func TestCommandSide_RemoveOrgIAMPolicy(t *testing.T) {
&org.NewAggregate("org1", "org1").Aggregate),
),
},
nil,
),
),
},
@@ -96,6 +96,7 @@ func TestCommandSide_AddPasswordAgePolicy(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -243,6 +244,7 @@ func TestCommandSide_ChangePasswordAgePolicy(t *testing.T) {
newPasswordAgePolicyChangedEvent(context.Background(), "org1", 150, 5),
),
},
nil,
),
),
},
@@ -354,6 +356,7 @@ func TestCommandSide_RemovePasswordAgePolicy(t *testing.T) {
&org.NewAggregate("org1", "org1").Aggregate),
),
},
nil,
),
),
},
@@ -102,6 +102,7 @@ func TestCommandSide_AddPasswordComplexityPolicy(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -264,6 +265,7 @@ func TestCommandSide_ChangePasswordComplexityPolicy(t *testing.T) {
newPasswordComplexityPolicyChangedEvent(context.Background(), "org1", 10, false, false, false, false),
),
},
nil,
),
),
},
@@ -381,6 +383,7 @@ func TestCommandSide_RemovePasswordComplexityPolicy(t *testing.T) {
&org.NewAggregate("org1", "org1").Aggregate),
),
},
nil,
),
),
},
@@ -96,6 +96,7 @@ func TestCommandSide_AddPasswordLockoutPolicy(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -243,6 +244,7 @@ func TestCommandSide_ChangePasswordLockoutPolicy(t *testing.T) {
newPasswordLockoutPolicyChangedEvent(context.Background(), "org1", 5, false),
),
},
nil,
),
),
},
@@ -354,6 +356,7 @@ func TestCommandSide_RemovePasswordLockoutPolicy(t *testing.T) {
&org.NewAggregate("org1", "org1").Aggregate),
),
},
nil,
),
),
},
+7
View File
@@ -148,6 +148,7 @@ func TestCommandSide_AddOrg(t *testing.T) {
&org.NewAggregate("org2", "org2").Aggregate,
"user1", domain.RoleOrgOwner)),
},
nil,
uniqueConstraintsFromEventConstraint(org.NewAddOrgNameUniqueConstraint("Org")),
uniqueConstraintsFromEventConstraint(org.NewAddOrgDomainUniqueConstraint("org.iam-domain")),
uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("org2", "user1")),
@@ -217,6 +218,7 @@ func TestCommandSide_AddOrg(t *testing.T) {
&org.NewAggregate("org2", "org2").Aggregate,
"user1", domain.RoleOrgOwner)),
},
nil,
uniqueConstraintsFromEventConstraint(org.NewAddOrgNameUniqueConstraint("Org")),
uniqueConstraintsFromEventConstraint(org.NewAddOrgDomainUniqueConstraint("org.iam-domain")),
uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("org2", "user1")),
@@ -286,6 +288,7 @@ func TestCommandSide_AddOrg(t *testing.T) {
domain.RoleOrgOwner,
)),
},
nil,
uniqueConstraintsFromEventConstraint(org.NewAddOrgNameUniqueConstraint("Org")),
uniqueConstraintsFromEventConstraint(org.NewAddOrgDomainUniqueConstraint("org.iam-domain")),
uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("org2", "user1")),
@@ -420,6 +423,7 @@ func TestCommandSide_DeactivateOrg(t *testing.T) {
eventFromEventPusher(org.NewOrgDeactivatedEvent(context.Background(),
&org.NewAggregate("org1", "org1").Aggregate)),
},
nil,
),
),
},
@@ -449,6 +453,7 @@ func TestCommandSide_DeactivateOrg(t *testing.T) {
&org.NewAggregate("org1", "org1").Aggregate,
)),
},
nil,
),
),
},
@@ -557,6 +562,7 @@ func TestCommandSide_ReactivateOrg(t *testing.T) {
&org.NewAggregate("org1", "org1").Aggregate,
)),
},
nil,
),
),
},
@@ -589,6 +595,7 @@ func TestCommandSide_ReactivateOrg(t *testing.T) {
eventFromEventPusher(org.NewOrgReactivatedEvent(context.Background(),
&org.NewAggregate("org1", "org1").Aggregate)),
},
nil,
),
),
},
@@ -139,6 +139,7 @@ func TestCommandSide_AddAPIApplication(t *testing.T) {
domain.APIAuthMethodTypeBasic),
),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewAddApplicationUniqueConstraint("app", "project1")),
),
),
@@ -201,6 +202,7 @@ func TestCommandSide_AddAPIApplication(t *testing.T) {
domain.APIAuthMethodTypePrivateKeyJWT),
),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewAddApplicationUniqueConstraint("app", "project1")),
),
),
@@ -418,6 +420,7 @@ func TestCommandSide_ChangeAPIApplication(t *testing.T) {
domain.APIAuthMethodTypePrivateKeyJWT),
),
},
nil,
),
),
},
@@ -580,6 +583,7 @@ func TestCommandSide_ChangeAPIApplicationSecret(t *testing.T) {
}),
),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -154,6 +154,7 @@ func TestCommandSide_AddOIDCApplication(t *testing.T) {
time.Second*1),
),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewAddApplicationUniqueConstraint("app", "project1")),
),
),
@@ -463,6 +464,7 @@ func TestCommandSide_ChangeOIDCApplication(t *testing.T) {
"org1"),
),
},
nil,
),
),
},
@@ -662,6 +664,7 @@ func TestCommandSide_ChangeOIDCApplicationSecret(t *testing.T) {
}),
),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -159,6 +159,7 @@ func TestCommandSide_ChangeApplication(t *testing.T) {
"app changed",
)),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewRemoveApplicationUniqueConstraint("app", "project1")),
uniqueConstraintsFromEventConstraint(project.NewAddApplicationUniqueConstraint("app changed", "project1")),
),
@@ -318,6 +319,7 @@ func TestCommandSide_DeactivateApplication(t *testing.T) {
"app1",
)),
},
nil,
),
),
},
@@ -472,6 +474,7 @@ func TestCommandSide_ReactivateApplication(t *testing.T) {
"app1",
)),
},
nil,
),
),
},
@@ -599,6 +602,7 @@ func TestCommandSide_RemoveApplication(t *testing.T) {
"app",
)),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewRemoveApplicationUniqueConstraint("app", "project1")),
),
),
@@ -186,6 +186,7 @@ func TestCommandSide_AddProjectGrantMember(t *testing.T) {
[]string{"PROJECT_GRANT_OWNER"}...,
)),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewAddProjectGrantMemberUniqueConstraint("project1", "user1", "projectgrant1")),
),
),
@@ -241,6 +242,7 @@ func TestCommandSide_AddProjectGrantMember(t *testing.T) {
[]string{"PROJECT_GRANT_OWNER"}...,
)),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewAddProjectGrantMemberUniqueConstraint("project1", "user1", "projectgrant1")),
),
),
@@ -442,6 +444,7 @@ func TestCommandSide_ChangeProjectGrantMember(t *testing.T) {
[]string{"PROJECT_GRANT_OWNER", "PROJECT_GRANT_VIEWER"}...,
)),
},
nil,
),
),
zitadelRoles: []authz.RoleMapping{
@@ -609,6 +612,7 @@ func TestCommandSide_RemoveProjectGrantMember(t *testing.T) {
"projectgrant1",
)),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewRemoveProjectGrantMemberUniqueConstraint("project1", "user1", "projectgrant1")),
),
),
+9
View File
@@ -179,6 +179,7 @@ func TestCommandSide_AddProjectGrant(t *testing.T) {
[]string{"key1"},
)),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewAddProjectGrantUniqueConstraint("grantedorg1", "project1")),
),
),
@@ -511,6 +512,7 @@ func TestCommandSide_ChangeProjectGrant(t *testing.T) {
[]string{"key1", "key2"},
)),
},
nil,
),
),
},
@@ -591,6 +593,7 @@ func TestCommandSide_ChangeProjectGrant(t *testing.T) {
[]string{"key1"},
)),
},
nil,
),
),
},
@@ -685,6 +688,7 @@ func TestCommandSide_ChangeProjectGrant(t *testing.T) {
[]string{"key1"},
)),
},
nil,
),
),
},
@@ -895,6 +899,7 @@ func TestCommandSide_DeactivateProjectGrant(t *testing.T) {
"projectgrant1",
)),
},
nil,
),
),
},
@@ -1091,6 +1096,7 @@ func TestCommandSide_ReactivateProjectGrant(t *testing.T) {
"projectgrant1",
)),
},
nil,
),
),
},
@@ -1252,6 +1258,7 @@ func TestCommandSide_RemoveProjectGrant(t *testing.T) {
"grantedorg1",
)),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewRemoveProjectGrantUniqueConstraint("grantedorg1", "project1")),
),
),
@@ -1298,6 +1305,7 @@ func TestCommandSide_RemoveProjectGrant(t *testing.T) {
"grantedorg1",
)),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewRemoveProjectGrantUniqueConstraint("grantedorg1", "project1")),
),
),
@@ -1357,6 +1365,7 @@ func TestCommandSide_RemoveProjectGrant(t *testing.T) {
"projectgrant1",
)),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewRemoveProjectGrantUniqueConstraint("grantedorg1", "project1")),
uniqueConstraintsFromEventConstraint(usergrant.NewRemoveUserGrantUniqueConstraint("org1", "user1", "project1", "projectgrant1")),
),
+4
View File
@@ -187,6 +187,7 @@ func TestCommandSide_AddProjectMember(t *testing.T) {
[]string{"PROJECT_OWNER"}...,
)),
},
nil,
uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("project1", "user1")),
),
),
@@ -241,6 +242,7 @@ func TestCommandSide_AddProjectMember(t *testing.T) {
[]string{"PROJECT_OWNER"}...,
)),
},
nil,
uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("project1", "user1")),
),
),
@@ -441,6 +443,7 @@ func TestCommandSide_ChangeProjectMember(t *testing.T) {
[]string{"PROJECT_OWNER", "PROJECT_VIEWER"}...,
)),
},
nil,
),
),
zitadelRoles: []authz.RoleMapping{
@@ -588,6 +591,7 @@ func TestCommandSide_RemoveProjectMember(t *testing.T) {
"user1",
)),
},
nil,
uniqueConstraintsFromEventConstraint(member.NewRemoveMemberUniqueConstraint("project1", "user1")),
),
),
+10
View File
@@ -119,6 +119,7 @@ func TestCommandSide_AddProjectRole(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewAddProjectRoleUniqueConstraint("key1", "project1")),
),
),
@@ -163,6 +164,7 @@ func TestCommandSide_AddProjectRole(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewAddProjectRoleUniqueConstraint("key1", "project1")),
),
),
@@ -332,6 +334,7 @@ func TestCommandSide_BulkAddProjectRole(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewAddProjectRoleUniqueConstraint("key1", "project1")),
uniqueConstraintsFromEventConstraint(project.NewAddProjectRoleUniqueConstraint("key2", "project1")),
),
@@ -390,6 +393,7 @@ func TestCommandSide_BulkAddProjectRole(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewAddProjectRoleUniqueConstraint("key1", "project1")),
uniqueConstraintsFromEventConstraint(project.NewAddProjectRoleUniqueConstraint("key2", "project1")),
),
@@ -629,6 +633,7 @@ func TestCommandSide_ChangeProjectRole(t *testing.T) {
newRoleChangedEvent(context.Background(), "project1", "org1", "key1", "keychanged", "groupchanged"),
),
},
nil,
),
),
},
@@ -806,6 +811,7 @@ func TestCommandSide_RemoveProjectRole(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewRemoveProjectRoleUniqueConstraint("key1", "project1")),
),
),
@@ -847,6 +853,7 @@ func TestCommandSide_RemoveProjectRole(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewRemoveProjectRoleUniqueConstraint("key1", "project1")),
),
),
@@ -905,6 +912,7 @@ func TestCommandSide_RemoveProjectRole(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewRemoveProjectRoleUniqueConstraint("key1", "project1")),
),
),
@@ -947,6 +955,7 @@ func TestCommandSide_RemoveProjectRole(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewRemoveProjectRoleUniqueConstraint("key1", "project1")),
),
),
@@ -1003,6 +1012,7 @@ func TestCommandSide_RemoveProjectRole(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewRemoveProjectRoleUniqueConstraint("key1", "project1")),
),
),
+8
View File
@@ -82,6 +82,7 @@ func TestCommandSide_AddProject(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewAddProjectNameUniqueConstraint("project", "org1")),
uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("project1", "user1")),
),
@@ -129,6 +130,7 @@ func TestCommandSide_AddProject(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewAddProjectNameUniqueConstraint("project", "globalorg")),
uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("project1", "user1")),
),
@@ -182,6 +184,7 @@ func TestCommandSide_AddProject(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewAddProjectNameUniqueConstraint("project", "org1")),
uniqueConstraintsFromEventConstraint(member.NewAddMemberUniqueConstraint("project1", "user1")),
),
@@ -391,6 +394,7 @@ func TestCommandSide_ChangeProject(t *testing.T) {
true),
),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewRemoveProjectNameUniqueConstraint("project", "org1")),
uniqueConstraintsFromEventConstraint(project.NewAddProjectNameUniqueConstraint("project-new", "org1")),
),
@@ -444,6 +448,7 @@ func TestCommandSide_ChangeProject(t *testing.T) {
true),
),
},
nil,
),
),
},
@@ -633,6 +638,7 @@ func TestCommandSide_DeactivateProject(t *testing.T) {
&project.NewAggregate("project1", "org1").Aggregate),
),
},
nil,
),
),
},
@@ -809,6 +815,7 @@ func TestCommandSide_ReactivateProject(t *testing.T) {
&project.NewAggregate("project1", "org1").Aggregate),
),
},
nil,
),
),
},
@@ -959,6 +966,7 @@ func TestCommandSide_RemoveProject(t *testing.T) {
"project"),
),
},
nil,
uniqueConstraintsFromEventConstraint(project.NewRemoveProjectNameUniqueConstraint("project", "org1")),
),
),
+10
View File
@@ -353,6 +353,7 @@ func TestCommandSide_AddUserGrant(t *testing.T) {
[]string{"rolekey1"},
)),
},
nil,
uniqueConstraintsFromEventConstraint(usergrant.NewAddUserGrantUniqueConstraint("org1", "user1", "project1", "")),
),
),
@@ -433,6 +434,7 @@ func TestCommandSide_AddUserGrant(t *testing.T) {
[]string{"rolekey1"},
)),
},
nil,
uniqueConstraintsFromEventConstraint(usergrant.NewAddUserGrantUniqueConstraint("org1", "user1", "project1", "projectgrant1")),
),
),
@@ -971,6 +973,7 @@ func TestCommandSide_ChangeUserGrant(t *testing.T) {
[]string{"rolekey1", "rolekey2"},
)),
},
nil,
),
),
},
@@ -1066,6 +1069,7 @@ func TestCommandSide_ChangeUserGrant(t *testing.T) {
[]string{"rolekey1", "rolekey2"},
)),
},
nil,
),
),
},
@@ -1290,6 +1294,7 @@ func TestCommandSide_DeactivateUserGrant(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -1502,6 +1507,7 @@ func TestCommandSide_ReactivateUserGrant(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -1673,6 +1679,7 @@ func TestCommandSide_RemoveUserGrant(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(usergrant.NewRemoveUserGrantUniqueConstraint("org1", "user1", "project1", "")),
),
),
@@ -1713,6 +1720,7 @@ func TestCommandSide_RemoveUserGrant(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(usergrant.NewRemoveUserGrantUniqueConstraint("org1", "user1", "project1", "projectgrant1")),
),
),
@@ -1898,6 +1906,7 @@ func TestCommandSide_BulkRemoveUserGrant(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(usergrant.NewRemoveUserGrantUniqueConstraint("org1", "user1", "project1", "")),
uniqueConstraintsFromEventConstraint(usergrant.NewRemoveUserGrantUniqueConstraint("org1", "user2", "project2", "")),
),
@@ -1952,6 +1961,7 @@ func TestCommandSide_BulkRemoveUserGrant(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(usergrant.NewRemoveUserGrantUniqueConstraint("org1", "user1", "project1", "projectgrant1")),
uniqueConstraintsFromEventConstraint(usergrant.NewRemoveUserGrantUniqueConstraint("org1", "user2", "project2", "projectgrant2")),
),
@@ -143,6 +143,7 @@ func TestCommandSide_ChangeHumanAddress(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -194,6 +194,7 @@ func TestCommandSide_ChangeHumanEmail(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -261,6 +262,7 @@ func TestCommandSide_ChangeHumanEmail(t *testing.T) {
),
),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -451,6 +453,7 @@ func TestCommandSide_VerifyHumanEmail(t *testing.T) {
),
),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -506,6 +509,7 @@ func TestCommandSide_VerifyHumanEmail(t *testing.T) {
),
),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -717,6 +721,7 @@ func TestCommandSide_CreateVerificationCodeHumanEmail(t *testing.T) {
),
),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -843,6 +848,7 @@ func TestCommandSide_EmailVerificationCodeSent(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -178,6 +178,7 @@ func TestCommandSide_BulkAddExternalIDPs(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewAddExternalIDPUniqueConstraint("config1", "externaluser1")),
),
),
@@ -227,6 +228,7 @@ func TestCommandSide_BulkAddExternalIDPs(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewAddExternalIDPUniqueConstraint("config1", "externaluser1")),
),
),
@@ -407,6 +409,7 @@ func TestCommandSide_RemoveExternalIDP(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewRemoveExternalIDPUniqueConstraint("config1", "externaluser1")),
),
),
@@ -549,6 +552,7 @@ func TestCommandSide_ExternalLoginCheck(t *testing.T) {
),
),
},
nil,
),
),
},
+7
View File
@@ -148,6 +148,7 @@ func TestCommandSide_ResendInitialMail(t *testing.T) {
),
),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -206,6 +207,7 @@ func TestCommandSide_ResendInitialMail(t *testing.T) {
),
),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -267,6 +269,7 @@ func TestCommandSide_ResendInitialMail(t *testing.T) {
),
),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -451,6 +454,7 @@ func TestCommandSide_VerifyInitCode(t *testing.T) {
),
),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -511,6 +515,7 @@ func TestCommandSide_VerifyInitCode(t *testing.T) {
),
),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -594,6 +599,7 @@ func TestCommandSide_VerifyInitCode(t *testing.T) {
false,
"")),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -710,6 +716,7 @@ func TestCommandSide_InitCodeSent(t *testing.T) {
),
),
},
nil,
),
),
},
+1
View File
@@ -304,6 +304,7 @@ func TestCommandSide_RemoveHumanOTP(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -125,6 +125,7 @@ func TestCommandSide_SetOneTimePassword(t *testing.T) {
),
),
},
nil,
),
),
userPasswordAlg: crypto.CreateMockHashAlg(gomock.NewController(t)),
@@ -384,6 +385,7 @@ func TestCommandSide_SetPassword(t *testing.T) {
),
),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -665,6 +667,7 @@ func TestCommandSide_ChangePassword(t *testing.T) {
),
),
},
nil,
),
),
userPasswordAlg: crypto.CreateMockHashAlg(gomock.NewController(t)),
@@ -850,6 +853,7 @@ func TestCommandSide_RequestSetPassword(t *testing.T) {
),
),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -971,6 +975,7 @@ func TestCommandSide_PasswordCodeSent(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -1152,6 +1157,7 @@ func TestCommandSide_CheckPassword(t *testing.T) {
),
),
},
nil,
),
),
userPasswordAlg: crypto.CreateMockHashAlg(gomock.NewController(t)),
@@ -1219,6 +1225,7 @@ func TestCommandSide_CheckPassword(t *testing.T) {
),
),
},
nil,
),
),
userPasswordAlg: crypto.CreateMockHashAlg(gomock.NewController(t)),
@@ -163,6 +163,7 @@ func TestCommandSide_ChangeHumanPhone(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -230,6 +231,7 @@ func TestCommandSide_ChangeHumanPhone(t *testing.T) {
),
),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -426,6 +428,7 @@ func TestCommandSide_VerifyHumanPhone(t *testing.T) {
),
),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -487,6 +490,7 @@ func TestCommandSide_VerifyHumanPhone(t *testing.T) {
),
),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -661,6 +665,7 @@ func TestCommandSide_CreateVerificationCodeHumanPhone(t *testing.T) {
),
),
},
nil,
),
),
secretGenerator: GetMockSecretGenerator(t),
@@ -782,6 +787,7 @@ func TestCommandSide_PhoneVerificationCodeSent(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -927,6 +933,7 @@ func TestCommandSide_RemoveHumanPhone(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -138,6 +138,7 @@ func TestCommandSide_ChangeHumanProfile(t *testing.T) {
),
),
},
nil,
),
),
},
+16
View File
@@ -225,6 +225,7 @@ func TestCommandSide_AddHuman(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)),
),
),
@@ -308,6 +309,7 @@ func TestCommandSide_AddHuman(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)),
),
),
@@ -387,6 +389,7 @@ func TestCommandSide_AddHuman(t *testing.T) {
&user.NewAggregate("user1", "org1").Aggregate),
),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)),
),
),
@@ -486,6 +489,7 @@ func TestCommandSide_AddHuman(t *testing.T) {
},
time.Hour*1)),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)),
),
),
@@ -579,6 +583,7 @@ func TestCommandSide_AddHuman(t *testing.T) {
&user.NewAggregate("user1", "org1").Aggregate),
),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)),
),
),
@@ -843,6 +848,7 @@ func TestCommandSide_ImportHuman(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)),
),
),
@@ -923,6 +929,7 @@ func TestCommandSide_ImportHuman(t *testing.T) {
&user.NewAggregate("user1", "org1").Aggregate),
),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)),
),
),
@@ -1023,6 +1030,7 @@ func TestCommandSide_ImportHuman(t *testing.T) {
},
time.Hour*1)),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)),
),
),
@@ -1121,6 +1129,7 @@ func TestCommandSide_ImportHuman(t *testing.T) {
&user.NewAggregate("user1", "org1").Aggregate),
),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)),
),
),
@@ -1381,6 +1390,7 @@ func TestCommandSide_RegisterHuman(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)),
),
),
@@ -1460,6 +1470,7 @@ func TestCommandSide_RegisterHuman(t *testing.T) {
&user.NewAggregate("user1", "org1").Aggregate),
),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)),
),
),
@@ -1559,6 +1570,7 @@ func TestCommandSide_RegisterHuman(t *testing.T) {
},
time.Hour*1)),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)),
),
),
@@ -1656,6 +1668,7 @@ func TestCommandSide_RegisterHuman(t *testing.T) {
&user.NewAggregate("user1", "org1").Aggregate),
),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)),
),
),
@@ -1814,6 +1827,7 @@ func TestCommandSide_HumanMFASkip(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -1943,6 +1957,7 @@ func TestCommandSide_HumanSignOut(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -2009,6 +2024,7 @@ func TestCommandSide_HumanSignOut(t *testing.T) {
),
),
},
nil,
),
),
},
+2
View File
@@ -128,6 +128,7 @@ func TestCommandSide_AddMachine(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username", "org1", true)),
),
),
@@ -291,6 +292,7 @@ func TestCommandSide_ChangeMachine(t *testing.T) {
newMachineChangedEvent(context.Background(), "user1", "org1", "name1", "description1"),
),
},
nil,
),
),
},
+7
View File
@@ -257,6 +257,7 @@ func TestCommandSide_UsernameChange(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewRemoveUsernameUniqueConstraint("username", "org1", true)),
uniqueConstraintsFromEventConstraint(user.NewAddUsernameUniqueConstraint("username1", "org1", true)),
),
@@ -414,6 +415,7 @@ func TestCommandSide_DeactivateUser(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -567,6 +569,7 @@ func TestCommandSide_ReactivateUser(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -721,6 +724,7 @@ func TestCommandSide_LockUser(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -874,6 +878,7 @@ func TestCommandSide_UnlockUser(t *testing.T) {
),
),
},
nil,
),
),
},
@@ -1036,6 +1041,7 @@ func TestCommandSide_RemoveUser(t *testing.T) {
),
),
},
nil,
uniqueConstraintsFromEventConstraint(user.NewRemoveUsernameUniqueConstraint("username", "org1", true)),
),
),
@@ -1231,6 +1237,7 @@ func TestCommandSide_UserDomainClaimedSent(t *testing.T) {
),
),
},
nil,
),
),
},