mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-11 16:45:13 +00:00
chore: add await for project to oidc integration tests (#8809)
# Which Problems Are Solved In integration tests there is waiting for the application, but the project is also included if the token can be created. # How the Problems Are Solved Wait for project not only for the application in the integration tests. # Additional Changes Some more corrections in integration tests. # Additional Context None --------- Co-authored-by: Livio Spring <[email protected]>
This commit is contained in:
co-authored by
Livio Spring
parent
d696d15a1c
commit
32d958ea43
@@ -190,7 +190,6 @@ func TestServer_GetUserByID(t *testing.T) {
|
||||
func TestServer_GetUserByID_Permission(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
timeNow := time.Now().UTC()
|
||||
newOrgOwnerEmail := gofakeit.Email()
|
||||
newOrg := Instance.CreateOrganization(IamCTX, fmt.Sprintf("GetHuman-%s", gofakeit.AppName()), newOrgOwnerEmail)
|
||||
newUserID := newOrg.CreatedAdmins[0].GetUserId()
|
||||
@@ -237,7 +236,7 @@ func TestServer_GetUserByID_Permission(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Details: &object.Details{
|
||||
ChangeDate: timestamppb.New(timeNow),
|
||||
ChangeDate: timestamppb.Now(),
|
||||
ResourceOwner: newOrg.GetOrganizationId(),
|
||||
},
|
||||
},
|
||||
@@ -275,7 +274,7 @@ func TestServer_GetUserByID_Permission(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Details: &object.Details{
|
||||
ChangeDate: timestamppb.New(timeNow),
|
||||
ChangeDate: timestamppb.Now(),
|
||||
ResourceOwner: newOrg.GetOrganizationId(),
|
||||
},
|
||||
},
|
||||
@@ -303,24 +302,29 @@ func TestServer_GetUserByID_Permission(t *testing.T) {
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, err := Client.GetUserByID(tt.args.ctx, tt.args.req)
|
||||
if tt.wantErr {
|
||||
require.Error(t, err)
|
||||
return
|
||||
}
|
||||
require.NoError(t, err)
|
||||
retryDuration, tick := integration.WaitForAndTickWithMaxDuration(tt.args.ctx, time.Minute)
|
||||
require.EventuallyWithT(t, func(ttt *assert.CollectT) {
|
||||
got, err := Client.GetUserByID(tt.args.ctx, tt.args.req)
|
||||
if tt.wantErr {
|
||||
assert.Error(ttt, err)
|
||||
return
|
||||
}
|
||||
if !assert.NoError(ttt, err) {
|
||||
return
|
||||
}
|
||||
|
||||
tt.want.User.UserId = tt.args.req.GetUserId()
|
||||
tt.want.User.Username = newOrgOwnerEmail
|
||||
tt.want.User.PreferredLoginName = newOrgOwnerEmail
|
||||
tt.want.User.LoginNames = []string{newOrgOwnerEmail}
|
||||
if human := tt.want.User.GetHuman(); human != nil {
|
||||
human.Email.Email = newOrgOwnerEmail
|
||||
}
|
||||
// details tested in GetUserByID
|
||||
tt.want.User.Details = got.User.GetDetails()
|
||||
tt.want.User.UserId = tt.args.req.GetUserId()
|
||||
tt.want.User.Username = newOrgOwnerEmail
|
||||
tt.want.User.PreferredLoginName = newOrgOwnerEmail
|
||||
tt.want.User.LoginNames = []string{newOrgOwnerEmail}
|
||||
if human := tt.want.User.GetHuman(); human != nil {
|
||||
human.Email.Email = newOrgOwnerEmail
|
||||
}
|
||||
// details tested in GetUserByID
|
||||
tt.want.User.Details = got.User.GetDetails()
|
||||
|
||||
assert.Equal(t, tt.want.User, got.User)
|
||||
assert.Equal(ttt, tt.want.User, got.User)
|
||||
}, retryDuration, tick, "timeout waiting for expected user result")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user