mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 01:47:33 +00:00
fix: all enums same style (#262)
* fix: all enums same style * fix: rename process to reduce * add some missing enum renaming Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
@@ -34,13 +34,13 @@ func OTPToModel(otp *OTP) *model.OTP {
|
||||
|
||||
func (u *User) appendOtpAddedEvent(event *es_models.Event) error {
|
||||
u.OTP = &OTP{
|
||||
State: int32(model.MFASTATE_NOTREADY),
|
||||
State: int32(model.MfaStateNotReady),
|
||||
}
|
||||
return u.OTP.setData(event)
|
||||
}
|
||||
|
||||
func (u *User) appendOtpVerifiedEvent() {
|
||||
u.OTP.State = int32(model.MFASTATE_READY)
|
||||
u.OTP.State = int32(model.MfaStateReady)
|
||||
}
|
||||
|
||||
func (u *User) appendOtpRemovedEvent() {
|
||||
|
@@ -26,7 +26,7 @@ func TestAppendMfaOTPAddedEvent(t *testing.T) {
|
||||
otp: &OTP{Secret: &crypto.CryptoValue{KeyID: "KeyID"}},
|
||||
event: &es_models.Event{},
|
||||
},
|
||||
result: &User{OTP: &OTP{Secret: &crypto.CryptoValue{KeyID: "KeyID"}, State: int32(model.MFASTATE_NOTREADY)}},
|
||||
result: &User{OTP: &OTP{Secret: &crypto.CryptoValue{KeyID: "KeyID"}, State: int32(model.MfaStateNotReady)}},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
@@ -61,7 +61,7 @@ func TestAppendMfaOTPVerifyEvent(t *testing.T) {
|
||||
otp: &OTP{Secret: &crypto.CryptoValue{KeyID: "KeyID"}},
|
||||
event: &es_models.Event{},
|
||||
},
|
||||
result: &User{OTP: &OTP{Secret: &crypto.CryptoValue{KeyID: "KeyID"}, State: int32(model.MFASTATE_READY)}},
|
||||
result: &User{OTP: &OTP{Secret: &crypto.CryptoValue{KeyID: "KeyID"}, State: int32(model.MfaStateReady)}},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
|
@@ -22,8 +22,8 @@ func TestProfileChanges(t *testing.T) {
|
||||
{
|
||||
name: "all attributes changed",
|
||||
args: args{
|
||||
existing: &Profile{UserName: "UserName", FirstName: "FirstName", LastName: "LastName", NickName: "NickName", DisplayName: "DisplayName", PreferredLanguage: language.German, Gender: int32(user_model.GENDER_FEMALE)},
|
||||
new: &Profile{UserName: "UserNameChanged", FirstName: "FirstNameChanged", LastName: "LastNameChanged", NickName: "NickNameChanged", DisplayName: "DisplayNameChanged", PreferredLanguage: language.English, Gender: int32(user_model.GENDER_MALE)},
|
||||
existing: &Profile{UserName: "UserName", FirstName: "FirstName", LastName: "LastName", NickName: "NickName", DisplayName: "DisplayName", PreferredLanguage: language.German, Gender: int32(user_model.GenderFemale)},
|
||||
new: &Profile{UserName: "UserNameChanged", FirstName: "FirstNameChanged", LastName: "LastNameChanged", NickName: "NickNameChanged", DisplayName: "DisplayNameChanged", PreferredLanguage: language.English, Gender: int32(user_model.GenderMale)},
|
||||
},
|
||||
res: res{
|
||||
changesLen: 6,
|
||||
@@ -32,8 +32,8 @@ func TestProfileChanges(t *testing.T) {
|
||||
{
|
||||
name: "no changes",
|
||||
args: args{
|
||||
existing: &Profile{UserName: "UserName", FirstName: "FirstName", LastName: "LastName", NickName: "NickName", DisplayName: "DisplayName", PreferredLanguage: language.German, Gender: int32(user_model.GENDER_FEMALE)},
|
||||
new: &Profile{UserName: "UserName", FirstName: "FirstName", LastName: "LastName", NickName: "NickName", DisplayName: "DisplayName", PreferredLanguage: language.German, Gender: int32(user_model.GENDER_FEMALE)},
|
||||
existing: &Profile{UserName: "UserName", FirstName: "FirstName", LastName: "LastName", NickName: "NickName", DisplayName: "DisplayName", PreferredLanguage: language.German, Gender: int32(user_model.GenderFemale)},
|
||||
new: &Profile{UserName: "UserName", FirstName: "FirstName", LastName: "LastName", NickName: "NickName", DisplayName: "DisplayName", PreferredLanguage: language.German, Gender: int32(user_model.GenderFemale)},
|
||||
},
|
||||
res: res{
|
||||
changesLen: 0,
|
||||
@@ -42,8 +42,8 @@ func TestProfileChanges(t *testing.T) {
|
||||
{
|
||||
name: "username changed",
|
||||
args: args{
|
||||
existing: &Profile{UserName: "UserName", FirstName: "FirstName", LastName: "LastName", NickName: "NickName", DisplayName: "DisplayName", PreferredLanguage: language.German, Gender: int32(user_model.GENDER_FEMALE)},
|
||||
new: &Profile{UserName: "UserNameChanged", FirstName: "FirstName", LastName: "LastName", NickName: "NickName", DisplayName: "DisplayName", PreferredLanguage: language.German, Gender: int32(user_model.GENDER_FEMALE)},
|
||||
existing: &Profile{UserName: "UserName", FirstName: "FirstName", LastName: "LastName", NickName: "NickName", DisplayName: "DisplayName", PreferredLanguage: language.German, Gender: int32(user_model.GenderFemale)},
|
||||
new: &Profile{UserName: "UserNameChanged", FirstName: "FirstName", LastName: "LastName", NickName: "NickName", DisplayName: "DisplayName", PreferredLanguage: language.German, Gender: int32(user_model.GenderFemale)},
|
||||
},
|
||||
res: res{
|
||||
changesLen: 0,
|
||||
@@ -52,8 +52,8 @@ func TestProfileChanges(t *testing.T) {
|
||||
{
|
||||
name: "empty names",
|
||||
args: args{
|
||||
existing: &Profile{UserName: "UserName", FirstName: "FirstName", LastName: "LastName", NickName: "NickName", DisplayName: "DisplayName", PreferredLanguage: language.German, Gender: int32(user_model.GENDER_FEMALE)},
|
||||
new: &Profile{UserName: "UserName", FirstName: "", LastName: "", NickName: "NickName", DisplayName: "DisplayName", PreferredLanguage: language.German, Gender: int32(user_model.GENDER_FEMALE)},
|
||||
existing: &Profile{UserName: "UserName", FirstName: "FirstName", LastName: "LastName", NickName: "NickName", DisplayName: "DisplayName", PreferredLanguage: language.German, Gender: int32(user_model.GenderFemale)},
|
||||
new: &Profile{UserName: "UserName", FirstName: "", LastName: "", NickName: "NickName", DisplayName: "DisplayName", PreferredLanguage: language.German, Gender: int32(user_model.GenderFemale)},
|
||||
},
|
||||
res: res{
|
||||
changesLen: 0,
|
||||
|
@@ -180,9 +180,9 @@ func (u *User) AppendEvent(event *es_models.Event) (err error) {
|
||||
func (u *User) ComputeObject() {
|
||||
if u.State == 0 {
|
||||
if u.Email != nil && u.IsEmailVerified {
|
||||
u.State = int32(model.USERSTATE_ACTIVE)
|
||||
u.State = int32(model.UserStateActive)
|
||||
} else {
|
||||
u.State = int32(model.USERSTATE_INITIAL)
|
||||
u.State = int32(model.UserStateInitial)
|
||||
}
|
||||
}
|
||||
if u.Password != nil && u.Password.ObjectRoot.IsZero() {
|
||||
@@ -211,19 +211,19 @@ func (u *User) setData(event *es_models.Event) error {
|
||||
}
|
||||
|
||||
func (u *User) appendDeactivatedEvent() {
|
||||
u.State = int32(model.USERSTATE_INACTIVE)
|
||||
u.State = int32(model.UserStateInactive)
|
||||
}
|
||||
|
||||
func (u *User) appendReactivatedEvent() {
|
||||
u.State = int32(model.USERSTATE_ACTIVE)
|
||||
u.State = int32(model.UserStateActive)
|
||||
}
|
||||
|
||||
func (u *User) appendLockedEvent() {
|
||||
u.State = int32(model.USERSTATE_LOCKED)
|
||||
u.State = int32(model.UserStateLocked)
|
||||
}
|
||||
|
||||
func (u *User) appendUnlockedEvent() {
|
||||
u.State = int32(model.USERSTATE_ACTIVE)
|
||||
u.State = int32(model.UserStateActive)
|
||||
}
|
||||
|
||||
func (u *User) appendInitUsercodeCreatedEvent(event *es_models.Event) error {
|
||||
|
@@ -22,7 +22,7 @@ func TestAppendDeactivatedEvent(t *testing.T) {
|
||||
args: args{
|
||||
user: &User{},
|
||||
},
|
||||
result: &User{State: int32(model.USERSTATE_INACTIVE)},
|
||||
result: &User{State: int32(model.UserStateInactive)},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
@@ -49,7 +49,7 @@ func TestAppendReactivatedEvent(t *testing.T) {
|
||||
args: args{
|
||||
user: &User{},
|
||||
},
|
||||
result: &User{State: int32(model.USERSTATE_ACTIVE)},
|
||||
result: &User{State: int32(model.UserStateActive)},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
@@ -76,7 +76,7 @@ func TestAppendLockEvent(t *testing.T) {
|
||||
args: args{
|
||||
user: &User{},
|
||||
},
|
||||
result: &User{State: int32(model.USERSTATE_LOCKED)},
|
||||
result: &User{State: int32(model.UserStateLocked)},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
@@ -103,7 +103,7 @@ func TestAppendUnlockEvent(t *testing.T) {
|
||||
args: args{
|
||||
user: &User{},
|
||||
},
|
||||
result: &User{State: int32(model.USERSTATE_ACTIVE)},
|
||||
result: &User{State: int32(model.UserStateActive)},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
|
Reference in New Issue
Block a user