mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-06 14:52:35 +00:00
chore: use integration package for name generation (#10591)
# Which Problems Are Solved
Integration test failed sometimes with `organization already
exists`-errors.
# How the Problems Are Solved
Use a consistent function to generate name used for organization
creation.
# Additional Changes
Correct a eventual consistent test for username around organization
domain changes with eventual consistent loop.
# Additional Context
None
---------
Co-authored-by: Livio Spring <livio.a@gmail.com>
(cherry picked from commit 5721b63bcb)
This commit is contained in:
committed by
Livio Spring
parent
678f9ad448
commit
d0d8e904c4
@@ -422,7 +422,7 @@ func TestCreateApplication_WithDifferentPermissions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateApplication(t *testing.T) {
|
||||
orgNotInCtx := instance.CreateOrganization(IAMOwnerCtx, integration.ProjectName(), gofakeit.Email())
|
||||
orgNotInCtx := instance.CreateOrganization(IAMOwnerCtx, integration.OrganizationName(), gofakeit.Email())
|
||||
pNotInCtx := instance.CreateProject(IAMOwnerCtx, t, orgNotInCtx.GetOrganizationId(), gofakeit.AppName(), false, false)
|
||||
|
||||
p := instance.CreateProject(IAMOwnerCtx, t, instance.DefaultOrg.GetId(), integration.ProjectName(), false, false)
|
||||
|
||||
@@ -256,7 +256,7 @@ func TestServer_CreateAdministrator(t *testing.T) {
|
||||
prepare: func(request *internal_permission.CreateAdministratorRequest) {
|
||||
userResp := instance.CreateUserTypeHuman(iamOwnerCtx, gofakeit.Email())
|
||||
projectResp := instance.CreateProject(iamOwnerCtx, t, instance.DefaultOrg.GetId(), integration.ProjectName(), false, false)
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, gofakeit.Company(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, integration.OrganizationName(), gofakeit.Email())
|
||||
instance.CreateProjectGrant(iamOwnerCtx, t, projectResp.GetId(), orgResp.GetOrganizationId())
|
||||
|
||||
request.UserId = userResp.GetId()
|
||||
@@ -282,7 +282,7 @@ func TestServer_CreateAdministrator(t *testing.T) {
|
||||
prepare: func(request *internal_permission.CreateAdministratorRequest) {
|
||||
userResp := instance.CreateUserTypeHuman(iamOwnerCtx, gofakeit.Email())
|
||||
projectResp := instance.CreateProject(iamOwnerCtx, t, instance.DefaultOrg.GetId(), integration.ProjectName(), false, false)
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, gofakeit.Company(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, integration.OrganizationName(), gofakeit.Email())
|
||||
instance.CreateProjectGrant(iamOwnerCtx, t, projectResp.GetId(), orgResp.GetOrganizationId())
|
||||
|
||||
request.UserId = userResp.GetId()
|
||||
@@ -862,7 +862,7 @@ func TestServer_UpdateAdministrator(t *testing.T) {
|
||||
prepare: func(request *internal_permission.UpdateAdministratorRequest) {
|
||||
userResp := instance.CreateUserTypeHuman(iamOwnerCtx, gofakeit.Email())
|
||||
projectResp := instance.CreateProject(iamOwnerCtx, t, instance.DefaultOrg.GetId(), integration.ProjectName(), false, false)
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, gofakeit.Company(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, integration.OrganizationName(), gofakeit.Email())
|
||||
instance.CreateProjectGrant(iamOwnerCtx, t, projectResp.GetId(), orgResp.GetOrganizationId())
|
||||
|
||||
request.UserId = userResp.GetId()
|
||||
@@ -886,7 +886,7 @@ func TestServer_UpdateAdministrator(t *testing.T) {
|
||||
prepare: func(request *internal_permission.UpdateAdministratorRequest) {
|
||||
userResp := instance.CreateUserTypeHuman(iamOwnerCtx, gofakeit.Email())
|
||||
projectResp := instance.CreateProject(iamOwnerCtx, t, instance.DefaultOrg.GetId(), integration.ProjectName(), false, false)
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, gofakeit.Company(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, integration.OrganizationName(), gofakeit.Email())
|
||||
instance.CreateProjectGrant(iamOwnerCtx, t, projectResp.GetId(), orgResp.GetOrganizationId())
|
||||
instance.CreateProjectGrantMembership(t, iamOwnerCtx, projectResp.GetId(), orgResp.GetOrganizationId(), userResp.GetId())
|
||||
|
||||
@@ -914,7 +914,7 @@ func TestServer_UpdateAdministrator(t *testing.T) {
|
||||
prepare: func(request *internal_permission.UpdateAdministratorRequest) {
|
||||
userResp := instance.CreateUserTypeHuman(iamOwnerCtx, gofakeit.Email())
|
||||
projectResp := instance.CreateProject(iamOwnerCtx, t, instance.DefaultOrg.GetId(), integration.ProjectName(), false, false)
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, gofakeit.Company(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, integration.OrganizationName(), gofakeit.Email())
|
||||
instance.CreateProjectGrant(iamOwnerCtx, t, projectResp.GetId(), orgResp.GetOrganizationId())
|
||||
instance.CreateProjectGrantMembership(t, iamOwnerCtx, projectResp.GetId(), orgResp.GetOrganizationId(), userResp.GetId())
|
||||
|
||||
@@ -942,7 +942,7 @@ func TestServer_UpdateAdministrator(t *testing.T) {
|
||||
prepare: func(request *internal_permission.UpdateAdministratorRequest) {
|
||||
userResp := instance.CreateUserTypeHuman(iamOwnerCtx, gofakeit.Email())
|
||||
projectResp := instance.CreateProject(iamOwnerCtx, t, instance.DefaultOrg.GetId(), integration.ProjectName(), false, false)
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, gofakeit.Company(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, integration.OrganizationName(), gofakeit.Email())
|
||||
instance.CreateProjectGrant(iamOwnerCtx, t, projectResp.GetId(), orgResp.GetOrganizationId())
|
||||
|
||||
request.UserId = userResp.GetId()
|
||||
@@ -1480,7 +1480,7 @@ func TestServer_DeleteAdministrator(t *testing.T) {
|
||||
creationDate := time.Now().UTC()
|
||||
userResp := instance.CreateUserTypeHuman(iamOwnerCtx, gofakeit.Email())
|
||||
projectResp := instance.CreateProject(iamOwnerCtx, t, instance.DefaultOrg.GetId(), integration.ProjectName(), false, false)
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, gofakeit.Company(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, integration.OrganizationName(), gofakeit.Email())
|
||||
instance.CreateProjectGrant(iamOwnerCtx, t, projectResp.GetId(), orgResp.GetOrganizationId())
|
||||
|
||||
request.UserId = userResp.GetId()
|
||||
@@ -1504,7 +1504,7 @@ func TestServer_DeleteAdministrator(t *testing.T) {
|
||||
creationDate := time.Now().UTC()
|
||||
userResp := instance.CreateUserTypeHuman(iamOwnerCtx, gofakeit.Email())
|
||||
projectResp := instance.CreateProject(iamOwnerCtx, t, instance.DefaultOrg.GetId(), integration.ProjectName(), false, false)
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, gofakeit.Company(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, integration.OrganizationName(), gofakeit.Email())
|
||||
instance.CreateProjectGrant(iamOwnerCtx, t, projectResp.GetId(), orgResp.GetOrganizationId())
|
||||
instance.CreateProjectGrantMembership(t, iamOwnerCtx, projectResp.GetId(), orgResp.GetOrganizationId(), userResp.GetId())
|
||||
|
||||
@@ -1529,7 +1529,7 @@ func TestServer_DeleteAdministrator(t *testing.T) {
|
||||
creationDate := time.Now().UTC()
|
||||
userResp := instance.CreateUserTypeHuman(iamOwnerCtx, gofakeit.Email())
|
||||
projectResp := instance.CreateProject(iamOwnerCtx, t, instance.DefaultOrg.GetId(), integration.ProjectName(), false, false)
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, gofakeit.Company(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, integration.OrganizationName(), gofakeit.Email())
|
||||
instance.CreateProjectGrant(iamOwnerCtx, t, projectResp.GetId(), orgResp.GetOrganizationId())
|
||||
instance.CreateProjectGrantMembership(t, iamOwnerCtx, projectResp.GetId(), orgResp.GetOrganizationId(), userResp.GetId())
|
||||
instance.DeleteProjectGrantMembership(t, iamOwnerCtx, projectResp.GetId(), orgResp.GetOrganizationId(), userResp.GetId())
|
||||
|
||||
@@ -21,7 +21,7 @@ func TestServer_ListAdministrators(t *testing.T) {
|
||||
|
||||
projectName := gofakeit.AppName()
|
||||
projectResp := instance.CreateProject(iamOwnerCtx, t, instance.DefaultOrg.GetId(), projectName, false, false)
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, gofakeit.Company(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, integration.OrganizationName(), gofakeit.Email())
|
||||
instance.CreateProjectGrant(iamOwnerCtx, t, projectResp.GetId(), orgResp.GetOrganizationId())
|
||||
|
||||
userProjectResp := instance.CreateMachineUser(iamOwnerCtx)
|
||||
|
||||
@@ -388,7 +388,7 @@ func TestServer_CreateCallback_Permission(t *testing.T) {
|
||||
projectID, clientID := createOIDCApplication(ctx, t, true, true)
|
||||
projectID2, _ := createOIDCApplication(ctx, t, true, true)
|
||||
|
||||
orgResp := Instance.CreateOrganization(ctx, "oidc-permission-"+gofakeit.AppName(), gofakeit.Email())
|
||||
orgResp := Instance.CreateOrganization(ctx, integration.OrganizationName(), gofakeit.Email())
|
||||
Instance.CreateProjectGrant(ctx, t, projectID2, orgResp.GetOrganizationId())
|
||||
user := Instance.CreateHumanUserVerified(ctx, orgResp.GetOrganizationId(), gofakeit.Email(), gofakeit.Phone())
|
||||
Instance.CreateProjectUserGrant(t, ctx, projectID, user.GetUserId())
|
||||
@@ -403,7 +403,7 @@ func TestServer_CreateCallback_Permission(t *testing.T) {
|
||||
dep: func(ctx context.Context, t *testing.T) *oidc_pb.CreateCallbackRequest {
|
||||
projectID, clientID := createOIDCApplication(ctx, t, true, true)
|
||||
|
||||
orgResp := Instance.CreateOrganization(ctx, "oidc-permission-"+gofakeit.AppName(), gofakeit.Email())
|
||||
orgResp := Instance.CreateOrganization(ctx, integration.OrganizationName(), gofakeit.Email())
|
||||
Instance.CreateProjectGrant(ctx, t, projectID, orgResp.GetOrganizationId())
|
||||
user := Instance.CreateHumanUserVerified(ctx, orgResp.GetOrganizationId(), gofakeit.Email(), gofakeit.Phone())
|
||||
Instance.CreateProjectUserGrant(t, ctx, projectID, user.GetUserId())
|
||||
@@ -424,7 +424,7 @@ func TestServer_CreateCallback_Permission(t *testing.T) {
|
||||
dep: func(ctx context.Context, t *testing.T) *oidc_pb.CreateCallbackRequest {
|
||||
projectID, clientID := createOIDCApplication(ctx, t, true, true)
|
||||
|
||||
orgResp := Instance.CreateOrganization(ctx, "oidc-permission-"+gofakeit.AppName(), gofakeit.Email())
|
||||
orgResp := Instance.CreateOrganization(ctx, integration.OrganizationName(), gofakeit.Email())
|
||||
Instance.CreateProjectGrant(ctx, t, projectID, orgResp.GetOrganizationId())
|
||||
user := Instance.CreateHumanUserVerified(ctx, orgResp.GetOrganizationId(), gofakeit.Email(), gofakeit.Phone())
|
||||
Instance.CreateProjectGrantUserGrant(ctx, orgResp.GetOrganizationId(), projectID, orgResp.GetOrganizationId(), user.GetUserId())
|
||||
@@ -445,7 +445,7 @@ func TestServer_CreateCallback_Permission(t *testing.T) {
|
||||
dep: func(ctx context.Context, t *testing.T) *oidc_pb.CreateCallbackRequest {
|
||||
_, clientID := createOIDCApplication(ctx, t, true, true)
|
||||
|
||||
orgResp := Instance.CreateOrganization(ctx, "oidc-permission-"+gofakeit.AppName(), gofakeit.Email())
|
||||
orgResp := Instance.CreateOrganization(ctx, integration.OrganizationName(), gofakeit.Email())
|
||||
user := Instance.CreateHumanUserVerified(ctx, orgResp.GetOrganizationId(), gofakeit.Email(), gofakeit.Phone())
|
||||
|
||||
return createSessionAndAuthRequestForCallback(ctx, t, clientID, Instance.Users.Get(integration.UserTypeLogin).ID, user.GetUserId())
|
||||
@@ -469,7 +469,7 @@ func TestServer_CreateCallback_Permission(t *testing.T) {
|
||||
dep: func(ctx context.Context, t *testing.T) *oidc_pb.CreateCallbackRequest {
|
||||
projectID, clientID := createOIDCApplication(ctx, t, true, true)
|
||||
|
||||
orgResp := Instance.CreateOrganization(ctx, "oidc-permission-"+gofakeit.AppName(), gofakeit.Email())
|
||||
orgResp := Instance.CreateOrganization(ctx, integration.OrganizationName(), gofakeit.Email())
|
||||
user := Instance.CreateHumanUserVerified(ctx, orgResp.GetOrganizationId(), gofakeit.Email(), gofakeit.Phone())
|
||||
Instance.CreateProjectUserGrant(t, ctx, projectID, user.GetUserId())
|
||||
|
||||
@@ -529,7 +529,7 @@ func TestServer_CreateCallback_Permission(t *testing.T) {
|
||||
ctx: CTXLoginClient,
|
||||
dep: func(ctx context.Context, t *testing.T) *oidc_pb.CreateCallbackRequest {
|
||||
projectID, clientID := createOIDCApplication(ctx, t, true, false)
|
||||
orgResp := Instance.CreateOrganization(ctx, "oidc-permission-"+gofakeit.AppName(), gofakeit.Email())
|
||||
orgResp := Instance.CreateOrganization(ctx, integration.OrganizationName(), gofakeit.Email())
|
||||
user := Instance.CreateHumanUserVerified(ctx, orgResp.GetOrganizationId(), gofakeit.Email(), gofakeit.Phone())
|
||||
Instance.CreateProjectUserGrant(t, ctx, projectID, user.GetUserId())
|
||||
|
||||
@@ -548,7 +548,7 @@ func TestServer_CreateCallback_Permission(t *testing.T) {
|
||||
ctx: CTXLoginClient,
|
||||
dep: func(ctx context.Context, t *testing.T) *oidc_pb.CreateCallbackRequest {
|
||||
_, clientID := createOIDCApplication(ctx, t, true, false)
|
||||
orgResp := Instance.CreateOrganization(ctx, "oidc-permission-"+gofakeit.AppName(), gofakeit.Email())
|
||||
orgResp := Instance.CreateOrganization(ctx, integration.OrganizationName(), gofakeit.Email())
|
||||
user := Instance.CreateHumanUserVerified(ctx, orgResp.GetOrganizationId(), gofakeit.Email(), gofakeit.Phone())
|
||||
|
||||
return createSessionAndAuthRequestForCallback(ctx, t, clientID, Instance.Users.Get(integration.UserTypeLogin).ID, user.GetUserId())
|
||||
@@ -561,7 +561,7 @@ func TestServer_CreateCallback_Permission(t *testing.T) {
|
||||
dep: func(ctx context.Context, t *testing.T) *oidc_pb.CreateCallbackRequest {
|
||||
projectID, clientID := createOIDCApplication(ctx, t, true, false)
|
||||
|
||||
orgResp := Instance.CreateOrganization(ctx, "oidc-permission-"+gofakeit.AppName(), gofakeit.Email())
|
||||
orgResp := Instance.CreateOrganization(ctx, integration.OrganizationName(), gofakeit.Email())
|
||||
Instance.CreateProjectGrant(ctx, t, projectID, orgResp.GetOrganizationId())
|
||||
user := Instance.CreateHumanUserVerified(ctx, orgResp.GetOrganizationId(), gofakeit.Email(), gofakeit.Phone())
|
||||
Instance.CreateProjectGrantUserGrant(ctx, orgResp.GetOrganizationId(), projectID, orgResp.GetOrganizationId(), user.GetUserId())
|
||||
@@ -581,7 +581,7 @@ func TestServer_CreateCallback_Permission(t *testing.T) {
|
||||
dep: func(ctx context.Context, t *testing.T) *oidc_pb.CreateCallbackRequest {
|
||||
projectID, clientID := createOIDCApplication(ctx, t, true, false)
|
||||
|
||||
orgResp := Instance.CreateOrganization(ctx, "oidc-permission-"+gofakeit.AppName(), gofakeit.Email())
|
||||
orgResp := Instance.CreateOrganization(ctx, integration.OrganizationName(), gofakeit.Email())
|
||||
Instance.CreateProjectGrant(ctx, t, projectID, orgResp.GetOrganizationId())
|
||||
user := Instance.CreateHumanUserVerified(ctx, orgResp.GetOrganizationId(), gofakeit.Email(), gofakeit.Phone())
|
||||
return createSessionAndAuthRequestForCallback(ctx, t, clientID, Instance.Users.Get(integration.UserTypeLogin).ID, user.GetUserId())
|
||||
@@ -610,7 +610,7 @@ func TestServer_CreateCallback_Permission(t *testing.T) {
|
||||
ctx: CTXLoginClient,
|
||||
dep: func(ctx context.Context, t *testing.T) *oidc_pb.CreateCallbackRequest {
|
||||
_, clientID := createOIDCApplication(ctx, t, false, true)
|
||||
orgResp := Instance.CreateOrganization(ctx, "oidc-permission-"+gofakeit.AppName(), gofakeit.Email())
|
||||
orgResp := Instance.CreateOrganization(ctx, integration.OrganizationName(), gofakeit.Email())
|
||||
user := Instance.CreateHumanUserVerified(ctx, orgResp.GetOrganizationId(), gofakeit.Email(), gofakeit.Phone())
|
||||
|
||||
return createSessionAndAuthRequestForCallback(ctx, t, clientID, Instance.Users.Get(integration.UserTypeLogin).ID, user.GetUserId())
|
||||
@@ -623,7 +623,7 @@ func TestServer_CreateCallback_Permission(t *testing.T) {
|
||||
dep: func(ctx context.Context, t *testing.T) *oidc_pb.CreateCallbackRequest {
|
||||
projectID, clientID := createOIDCApplication(ctx, t, false, true)
|
||||
|
||||
orgResp := Instance.CreateOrganization(ctx, "oidc-permission-"+gofakeit.AppName(), gofakeit.Email())
|
||||
orgResp := Instance.CreateOrganization(ctx, integration.OrganizationName(), gofakeit.Email())
|
||||
Instance.CreateProjectGrant(ctx, t, projectID, orgResp.GetOrganizationId())
|
||||
user := Instance.CreateHumanUserVerified(ctx, orgResp.GetOrganizationId(), gofakeit.Email(), gofakeit.Phone())
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ func TestServer_ListOrganizations(t *testing.T) {
|
||||
func(ctx context.Context, request *org.ListOrganizationsRequest) ([]orgAttr, error) {
|
||||
count := 3
|
||||
orgs := make([]orgAttr, count)
|
||||
prefix := fmt.Sprintf("ListOrgs-%s", gofakeit.AppName())
|
||||
prefix := integration.OrganizationName()
|
||||
for i := 0; i < count; i++ {
|
||||
name := prefix + strconv.Itoa(i)
|
||||
orgs[i] = createOrganization(ctx, name)
|
||||
@@ -275,8 +275,7 @@ func TestServer_ListOrganizations(t *testing.T) {
|
||||
&org.ListOrganizationsRequest{},
|
||||
func(ctx context.Context, request *org.ListOrganizationsRequest) ([]orgAttr, error) {
|
||||
orgs := make([]orgAttr, 1)
|
||||
name := fmt.Sprintf("ListOrgs-%s", gofakeit.AppName())
|
||||
orgs[0] = createOrganization(ctx, name)
|
||||
orgs[0] = createOrganization(ctx, integration.OrganizationName())
|
||||
domain := gofakeit.DomainName()
|
||||
_, err := Instance.Client.Mgmt.AddOrgDomain(integration.SetOrgID(ctx, orgs[0].ID), &management.AddOrgDomainRequest{
|
||||
Domain: domain,
|
||||
@@ -311,7 +310,7 @@ func TestServer_ListOrganizations(t *testing.T) {
|
||||
Queries: []*org.SearchQuery{},
|
||||
},
|
||||
func(ctx context.Context, request *org.ListOrganizationsRequest) ([]orgAttr, error) {
|
||||
name := gofakeit.Name()
|
||||
name := integration.OrganizationName()
|
||||
orgResp := createOrganization(ctx, name)
|
||||
deactivateOrgResp := Instance.DeactivateOrganization(ctx, orgResp.ID)
|
||||
request.Queries = []*org.SearchQuery{
|
||||
|
||||
@@ -1132,29 +1132,31 @@ func TestServer_AddOrganizationDomain_ClaimDomain(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
// check both users: the first one must be untouched, the second one must be updated
|
||||
users, err := Instance.Client.UserV2.ListUsers(CTX, &user.ListUsersRequest{
|
||||
Queries: []*user.SearchQuery{
|
||||
{
|
||||
Query: &user.SearchQuery_InUserIdsQuery{
|
||||
InUserIdsQuery: &user.InUserIDQuery{UserIds: []string{ownUser.GetUserId(), otherUser.GetUserId()}},
|
||||
require.EventuallyWithT(t, func(collect *assert.CollectT) {
|
||||
// check both users: the first one must be untouched, the second one must be updated
|
||||
users, err := Instance.Client.UserV2.ListUsers(CTX, &user.ListUsersRequest{
|
||||
Queries: []*user.SearchQuery{
|
||||
{
|
||||
Query: &user.SearchQuery_InUserIdsQuery{
|
||||
InUserIdsQuery: &user.InUserIDQuery{UserIds: []string{ownUser.GetUserId(), otherUser.GetUserId()}},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Len(t, users.GetResult(), 2)
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Len(t, users.GetResult(), 2)
|
||||
|
||||
for _, u := range users.GetResult() {
|
||||
if u.GetUserId() == ownUser.GetUserId() {
|
||||
assert.Equal(t, username, u.GetPreferredLoginName())
|
||||
continue
|
||||
for _, u := range users.GetResult() {
|
||||
if u.GetUserId() == ownUser.GetUserId() {
|
||||
assert.Equal(collect, username, u.GetPreferredLoginName())
|
||||
continue
|
||||
}
|
||||
if u.GetUserId() == otherUser.GetUserId() {
|
||||
assert.NotEqual(collect, otherUsername, u.GetPreferredLoginName())
|
||||
assert.Contains(collect, u.GetPreferredLoginName(), "@temporary.")
|
||||
}
|
||||
}
|
||||
if u.GetUserId() == otherUser.GetUserId() {
|
||||
assert.NotEqual(t, otherUsername, u.GetPreferredLoginName())
|
||||
assert.Contains(t, u.GetPreferredLoginName(), "@temporary.")
|
||||
}
|
||||
}
|
||||
}, 5*time.Second, time.Second, "user not updated in time")
|
||||
}
|
||||
|
||||
func TestServer_ListOrganizationDomains(t *testing.T) {
|
||||
|
||||
@@ -509,8 +509,8 @@ func TestServer_ListProjects(t *testing.T) {
|
||||
dep: func(request *project.ListProjectsRequest, response *project.ListProjectsResponse) {
|
||||
orgID := instance.DefaultOrg.GetId()
|
||||
|
||||
orgName := gofakeit.AppName()
|
||||
projectName := gofakeit.AppName()
|
||||
orgName := integration.OrganizationName()
|
||||
projectName := integration.ProjectName()
|
||||
orgResp := instance.CreateOrganization(iamOwnerCtx, orgName, gofakeit.Email())
|
||||
projectResp := instance.CreateProject(iamOwnerCtx, t, orgResp.GetOrganizationId(), projectName, true, true)
|
||||
projectGrantResp := instance.CreateProjectGrant(iamOwnerCtx, t, projectResp.GetId(), orgID)
|
||||
@@ -633,7 +633,7 @@ func TestServer_ListProjects_PermissionV2(t *testing.T) {
|
||||
args: args{
|
||||
ctx: instancePermissionV2.WithAuthorizationToken(CTX, integration.UserTypeOrgOwner),
|
||||
dep: func(request *project.ListProjectsRequest, response *project.ListProjectsResponse) {
|
||||
orgResp := instancePermissionV2.CreateOrganization(iamOwnerCtx, integration.ProjectName(), gofakeit.Email())
|
||||
orgResp := instancePermissionV2.CreateOrganization(iamOwnerCtx, integration.OrganizationName(), gofakeit.Email())
|
||||
resp := createProject(iamOwnerCtx, instancePermissionV2, t, orgResp.GetOrganizationId(), false, false)
|
||||
request.Filters[0].Filter = &project.ProjectSearchFilter_InProjectIdsFilter{
|
||||
InProjectIdsFilter: &filter.InIDsFilter{
|
||||
@@ -851,7 +851,7 @@ func TestServer_ListProjects_PermissionV2(t *testing.T) {
|
||||
args: args{
|
||||
ctx: instancePermissionV2.WithAuthorizationToken(CTX, integration.UserTypeOrgOwner),
|
||||
dep: func(request *project.ListProjectsRequest, response *project.ListProjectsResponse) {
|
||||
orgResp := instancePermissionV2.CreateOrganization(iamOwnerCtx, integration.ProjectName(), gofakeit.Email())
|
||||
orgResp := instancePermissionV2.CreateOrganization(iamOwnerCtx, integration.OrganizationName(), gofakeit.Email())
|
||||
resp1 := createProject(iamOwnerCtx, instancePermissionV2, t, orgResp.GetOrganizationId(), false, false)
|
||||
resp2 := createProject(iamOwnerCtx, instancePermissionV2, t, orgID, true, false)
|
||||
resp3 := createProject(iamOwnerCtx, instancePermissionV2, t, orgResp.GetOrganizationId(), false, true)
|
||||
@@ -884,8 +884,8 @@ func TestServer_ListProjects_PermissionV2(t *testing.T) {
|
||||
dep: func(request *project.ListProjectsRequest, response *project.ListProjectsResponse) {
|
||||
orgID := instancePermissionV2.DefaultOrg.GetId()
|
||||
|
||||
orgName := gofakeit.AppName()
|
||||
projectName := gofakeit.AppName()
|
||||
orgName := integration.OrganizationName()
|
||||
projectName := integration.ProjectName()
|
||||
orgResp := instancePermissionV2.CreateOrganization(iamOwnerCtx, orgName, gofakeit.Email())
|
||||
projectResp := instancePermissionV2.CreateProject(iamOwnerCtx, t, orgResp.GetOrganizationId(), projectName, true, true)
|
||||
projectGrantResp := instancePermissionV2.CreateProjectGrant(iamOwnerCtx, t, projectResp.GetId(), orgID)
|
||||
@@ -1366,7 +1366,7 @@ func TestServer_ListProjectGrants_PermissionV2(t *testing.T) {
|
||||
Ids: []string{projectResp.GetId()},
|
||||
},
|
||||
}
|
||||
grantedOrg := instancePermissionV2.CreateOrganization(iamOwnerCtx, integration.ProjectName(), gofakeit.Email())
|
||||
grantedOrg := instancePermissionV2.CreateOrganization(iamOwnerCtx, integration.OrganizationName(), gofakeit.Email())
|
||||
request.Filters[1].Filter = &project.ProjectGrantSearchFilter_ProjectGrantResourceOwnerFilter{
|
||||
ProjectGrantResourceOwnerFilter: &filter.IDFilter{Id: grantedOrg.GetOrganizationId()},
|
||||
}
|
||||
@@ -1390,7 +1390,7 @@ func TestServer_ListProjectGrants_PermissionV2(t *testing.T) {
|
||||
Ids: []string{projectResp.GetId()},
|
||||
},
|
||||
}
|
||||
grantedOrg := instancePermissionV2.CreateOrganization(iamOwnerCtx, integration.ProjectName(), gofakeit.Email())
|
||||
grantedOrg := instancePermissionV2.CreateOrganization(iamOwnerCtx, integration.OrganizationName(), gofakeit.Email())
|
||||
request.Filters[1].Filter = &project.ProjectGrantSearchFilter_ProjectGrantResourceOwnerFilter{
|
||||
ProjectGrantResourceOwnerFilter: &filter.IDFilter{Id: grantedOrg.GetOrganizationId()},
|
||||
}
|
||||
@@ -1439,7 +1439,7 @@ func TestServer_ListProjectGrants_PermissionV2(t *testing.T) {
|
||||
ctx: instancePermissionV2.WithAuthorizationToken(CTX, integration.UserTypeOrgOwner),
|
||||
dep: func(request *project.ListProjectGrantsRequest, response *project.ListProjectGrantsResponse) {
|
||||
name := gofakeit.AppName()
|
||||
orgResp := instancePermissionV2.CreateOrganization(iamOwnerCtx, integration.ProjectName(), gofakeit.Email())
|
||||
orgResp := instancePermissionV2.CreateOrganization(iamOwnerCtx, integration.OrganizationName(), gofakeit.Email())
|
||||
projectResp := instancePermissionV2.CreateProject(iamOwnerCtx, t, orgResp.GetOrganizationId(), name, false, false)
|
||||
request.Filters[0].Filter = &project.ProjectGrantSearchFilter_InProjectIdsFilter{
|
||||
InProjectIdsFilter: &filter.InIDsFilter{
|
||||
@@ -1502,7 +1502,7 @@ func TestServer_ListProjectGrants_PermissionV2(t *testing.T) {
|
||||
name2 := gofakeit.AppName()
|
||||
name3 := gofakeit.AppName()
|
||||
orgID := instancePermissionV2.DefaultOrg.GetId()
|
||||
orgResp := instancePermissionV2.CreateOrganization(iamOwnerCtx, integration.ProjectName(), gofakeit.Email())
|
||||
orgResp := instancePermissionV2.CreateOrganization(iamOwnerCtx, integration.OrganizationName(), gofakeit.Email())
|
||||
project1Resp := instancePermissionV2.CreateProject(iamOwnerCtx, t, orgID, name1, false, false)
|
||||
project2Resp := instancePermissionV2.CreateProject(iamOwnerCtx, t, orgResp.GetOrganizationId(), name2, false, false)
|
||||
project3Resp := instancePermissionV2.CreateProject(iamOwnerCtx, t, orgResp.GetOrganizationId(), name3, false, false)
|
||||
@@ -1800,7 +1800,7 @@ func TestServer_ListProjectRoles_PermissionV2(t *testing.T) {
|
||||
args: args{
|
||||
ctx: instancePermissionV2.WithAuthorizationToken(CTX, integration.UserTypeOrgOwner),
|
||||
dep: func(request *project.ListProjectRolesRequest, response *project.ListProjectRolesResponse) {
|
||||
orgResp := instancePermissionV2.CreateOrganization(iamOwnerCtx, integration.ProjectName(), gofakeit.Email())
|
||||
orgResp := instancePermissionV2.CreateOrganization(iamOwnerCtx, integration.OrganizationName(), gofakeit.Email())
|
||||
projectResp := instancePermissionV2.CreateProject(iamOwnerCtx, t, orgResp.GetOrganizationId(), integration.ProjectName(), false, false)
|
||||
|
||||
request.ProjectId = projectResp.GetId()
|
||||
|
||||
@@ -33,7 +33,7 @@ func TestServer_SetContactEmail(t *testing.T) {
|
||||
}
|
||||
}`)
|
||||
schemaResp := instance.CreateUserSchema(isolatedIAMOwnerCTX, schema)
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, gofakeit.Name(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
|
||||
type res struct {
|
||||
want *resource_object.Details
|
||||
@@ -378,7 +378,7 @@ func TestServer_VerifyContactEmail(t *testing.T) {
|
||||
}
|
||||
}`)
|
||||
schemaResp := instance.CreateUserSchema(isolatedIAMOwnerCTX, schema)
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, gofakeit.Name(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
|
||||
type res struct {
|
||||
want *resource_object.Details
|
||||
@@ -567,7 +567,7 @@ func TestServer_ResendContactEmailCode(t *testing.T) {
|
||||
}
|
||||
}`)
|
||||
schemaResp := instance.CreateUserSchema(isolatedIAMOwnerCTX, schema)
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, gofakeit.Name(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
|
||||
type res struct {
|
||||
want *resource_object.Details
|
||||
|
||||
@@ -32,7 +32,7 @@ func TestServer_SetContactPhone(t *testing.T) {
|
||||
}
|
||||
}`)
|
||||
schemaResp := instance.CreateUserSchema(isolatedIAMOwnerCTX, schema)
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, gofakeit.Name(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
|
||||
type res struct {
|
||||
want *resource_object.Details
|
||||
@@ -305,7 +305,7 @@ func TestServer_VerifyContactPhone(t *testing.T) {
|
||||
}
|
||||
}`)
|
||||
schemaResp := instance.CreateUserSchema(isolatedIAMOwnerCTX, schema)
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, gofakeit.Name(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
|
||||
type res struct {
|
||||
want *resource_object.Details
|
||||
@@ -496,7 +496,7 @@ func TestServer_ResendContactPhoneCode(t *testing.T) {
|
||||
}
|
||||
}`)
|
||||
schemaResp := instance.CreateUserSchema(isolatedIAMOwnerCTX, schema)
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, gofakeit.Name(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
|
||||
type res struct {
|
||||
want *resource_object.Details
|
||||
|
||||
@@ -49,7 +49,7 @@ func TestServer_CreateUser(t *testing.T) {
|
||||
}
|
||||
}`)
|
||||
permissionSchemaResp := instance.CreateUserSchema(isolatedIAMOwnerCTX, permissionSchema)
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, gofakeit.Name(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
|
||||
type res struct {
|
||||
want *resource_object.Details
|
||||
@@ -257,7 +257,7 @@ func TestServer_PatchUser(t *testing.T) {
|
||||
}
|
||||
}`)
|
||||
permissionSchemaResp := instance.CreateUserSchema(isolatedIAMOwnerCTX, permissionSchema)
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, gofakeit.Name(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
|
||||
type res struct {
|
||||
want *resource_object.Details
|
||||
@@ -662,7 +662,7 @@ func TestServer_DeleteUser(t *testing.T) {
|
||||
}
|
||||
}`)
|
||||
schemaResp := instance.CreateUserSchema(isolatedIAMOwnerCTX, schema)
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, gofakeit.Name(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -878,7 +878,7 @@ func TestServer_LockUser(t *testing.T) {
|
||||
}
|
||||
}`)
|
||||
schemaResp := instance.CreateUserSchema(isolatedIAMOwnerCTX, schema)
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, gofakeit.Name(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -1079,7 +1079,7 @@ func TestServer_UnlockUser(t *testing.T) {
|
||||
}
|
||||
}`)
|
||||
schemaResp := instance.CreateUserSchema(isolatedIAMOwnerCTX, schema)
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, gofakeit.Name(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -1261,7 +1261,7 @@ func TestServer_DeactivateUser(t *testing.T) {
|
||||
}
|
||||
}`)
|
||||
schemaResp := instance.CreateUserSchema(isolatedIAMOwnerCTX, schema)
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, gofakeit.Name(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -1462,7 +1462,7 @@ func TestServer_ActivateUser(t *testing.T) {
|
||||
}
|
||||
}`)
|
||||
schemaResp := instance.CreateUserSchema(isolatedIAMOwnerCTX, schema)
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, gofakeit.Name(), gofakeit.Email())
|
||||
orgResp := instance.CreateOrganization(isolatedIAMOwnerCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
@@ -4,7 +4,6 @@ package user_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"slices"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -377,7 +376,7 @@ func TestServer_ListKeys(t *testing.T) {
|
||||
want *user.ListKeysResponse
|
||||
}
|
||||
OrgCTX := CTX
|
||||
otherOrg := Instance.CreateOrganization(SystemCTX, fmt.Sprintf("ListKeys-%s", gofakeit.AppName()), gofakeit.Email())
|
||||
otherOrg := Instance.CreateOrganization(SystemCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
otherOrgUser, err := Client.CreateUser(SystemCTX, &user.CreateUserRequest{
|
||||
OrganizationId: otherOrg.OrganizationId,
|
||||
UserType: &user.CreateUserRequest_Machine_{
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
)
|
||||
|
||||
func TestServer_SetUserMetadata(t *testing.T) {
|
||||
iamOwnerCTX := Instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
iamOwnerCTX := Instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -31,7 +31,7 @@ func TestServer_SetUserMetadata(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "missing permission",
|
||||
ctx: Instance.WithAuthorization(context.Background(), integration.UserTypeNoPermission),
|
||||
ctx: Instance.WithAuthorizationToken(context.Background(), integration.UserTypeNoPermission),
|
||||
dep: func(req *user.SetUserMetadataRequest) {
|
||||
req.UserId = Instance.CreateUserTypeHuman(CTX, gofakeit.Email()).GetId()
|
||||
},
|
||||
@@ -77,7 +77,7 @@ func TestServer_SetUserMetadata(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "update user metadata",
|
||||
ctx: Instance.WithAuthorization(CTX, integration.UserTypeIAMOwner),
|
||||
ctx: Instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner),
|
||||
dep: func(req *user.SetUserMetadataRequest) {
|
||||
req.UserId = Instance.CreateUserTypeHuman(iamOwnerCTX, gofakeit.Email()).GetId()
|
||||
Instance.SetUserMetadata(iamOwnerCTX, req.UserId, "key1", "value1")
|
||||
@@ -89,7 +89,7 @@ func TestServer_SetUserMetadata(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "update user metadata with same value",
|
||||
ctx: Instance.WithAuthorization(CTX, integration.UserTypeIAMOwner),
|
||||
ctx: Instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner),
|
||||
dep: func(req *user.SetUserMetadataRequest) {
|
||||
req.UserId = Instance.CreateUserTypeHuman(iamOwnerCTX, gofakeit.Email()).GetId()
|
||||
Instance.SetUserMetadata(iamOwnerCTX, req.UserId, "key1", "value1")
|
||||
@@ -132,7 +132,7 @@ func assertSetUserMetadataResponse(t *testing.T, creationDate, changeDate time.T
|
||||
}
|
||||
|
||||
func TestServer_ListUserMetadata(t *testing.T) {
|
||||
iamOwnerCTX := Instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
iamOwnerCTX := Instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
@@ -149,7 +149,7 @@ func TestServer_ListUserMetadata(t *testing.T) {
|
||||
{
|
||||
name: "missing permission",
|
||||
args: args{
|
||||
ctx: Instance.WithAuthorization(context.Background(), integration.UserTypeNoPermission),
|
||||
ctx: Instance.WithAuthorizationToken(context.Background(), integration.UserTypeNoPermission),
|
||||
dep: func(ctx context.Context, request *user.ListUserMetadataRequest, response *user.ListUserMetadataResponse) {
|
||||
userID := Instance.CreateUserTypeHuman(iamOwnerCTX, gofakeit.Email()).GetId()
|
||||
request.UserId = userID
|
||||
@@ -281,7 +281,7 @@ func assertPaginationResponse(t *assert.CollectT, expected *filter.PaginationRes
|
||||
}
|
||||
|
||||
func TestServer_DeleteUserMetadata(t *testing.T) {
|
||||
iamOwnerCTX := Instance.WithAuthorization(CTX, integration.UserTypeIAMOwner)
|
||||
iamOwnerCTX := Instance.WithAuthorizationToken(CTX, integration.UserTypeIAMOwner)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
@@ -1884,7 +1884,7 @@ func TestServer_DeleteUser(t *testing.T) {
|
||||
func TestServer_StartIdentityProviderIntent(t *testing.T) {
|
||||
idpResp := Instance.AddGenericOAuthProvider(IamCTX, Instance.DefaultOrg.Id)
|
||||
orgIdpResp := Instance.AddOrgGenericOAuthProvider(CTX, Instance.DefaultOrg.Id)
|
||||
orgResp := Instance.CreateOrganization(IamCTX, fmt.Sprintf("NotDefaultOrg-%s", gofakeit.AppName()), gofakeit.Email())
|
||||
orgResp := Instance.CreateOrganization(IamCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
notDefaultOrgIdpResp := Instance.AddOrgGenericOAuthProvider(IamCTX, orgResp.OrganizationId)
|
||||
samlIdpID := Instance.AddSAMLProvider(IamCTX)
|
||||
samlRedirectIdpID := Instance.AddSAMLRedirectProvider(IamCTX, "")
|
||||
@@ -4631,7 +4631,7 @@ func TestServer_CreateUser_And_Compare(t *testing.T) {
|
||||
|
||||
func TestServer_CreateUser_Permission(t *testing.T) {
|
||||
newOrgOwnerEmail := gofakeit.Email()
|
||||
newOrg := Instance.CreateOrganization(IamCTX, fmt.Sprintf("AddHuman-%s", gofakeit.AppName()), newOrgOwnerEmail)
|
||||
newOrg := Instance.CreateOrganization(IamCTX, integration.OrganizationName(), newOrgOwnerEmail)
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
req *user.CreateUserRequest
|
||||
@@ -5302,7 +5302,7 @@ func TestServer_UpdateUser_And_Compare(t *testing.T) {
|
||||
|
||||
func TestServer_UpdateUser_Permission(t *testing.T) {
|
||||
newOrgOwnerEmail := gofakeit.Email()
|
||||
newOrg := Instance.CreateOrganization(IamCTX, fmt.Sprintf("AddHuman-%s", gofakeit.AppName()), newOrgOwnerEmail)
|
||||
newOrg := Instance.CreateOrganization(IamCTX, integration.OrganizationName(), newOrgOwnerEmail)
|
||||
newHumanUserID := newOrg.CreatedAdmins[0].GetUserId()
|
||||
machineUserResp, err := Instance.Client.UserV2.CreateUser(IamCTX, &user.CreateUserRequest{
|
||||
OrganizationId: newOrg.OrganizationId,
|
||||
|
||||
@@ -5,7 +5,6 @@ package user_test
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"slices"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -82,7 +81,7 @@ func setPermissionCheckV2Flag(t *testing.T, setFlag bool) {
|
||||
}
|
||||
|
||||
func TestServer_GetUserByID(t *testing.T) {
|
||||
orgResp := Instance.CreateOrganization(IamCTX, fmt.Sprintf("GetUserByIDOrg-%s", gofakeit.AppName()), gofakeit.Email())
|
||||
orgResp := Instance.CreateOrganization(IamCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
req *user.GetUserByIDRequest
|
||||
@@ -246,7 +245,7 @@ func TestServer_GetUserByID(t *testing.T) {
|
||||
func TestServer_GetUserByID_Permission(t *testing.T) {
|
||||
timeNow := time.Now().UTC()
|
||||
newOrgOwnerEmail := gofakeit.Email()
|
||||
newOrg := Instance.CreateOrganization(IamCTX, fmt.Sprintf("GetHuman-%s", gofakeit.AppName()), newOrgOwnerEmail)
|
||||
newOrg := Instance.CreateOrganization(IamCTX, integration.OrganizationName(), newOrgOwnerEmail)
|
||||
newUserID := newOrg.CreatedAdmins[0].GetUserId()
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
@@ -438,7 +437,7 @@ func TestServer_ListUsers(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
}()
|
||||
|
||||
orgResp := Instance.CreateOrganization(IamCTX, fmt.Sprintf("ListUsersOrg-%s", gofakeit.AppName()), gofakeit.Email())
|
||||
orgResp := Instance.CreateOrganization(IamCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
req *user.ListUsersRequest
|
||||
@@ -979,7 +978,7 @@ func TestServer_ListUsers(t *testing.T) {
|
||||
IamCTX,
|
||||
&user.ListUsersRequest{},
|
||||
func(ctx context.Context, request *user.ListUsersRequest) userAttrs {
|
||||
orgResp := Instance.CreateOrganization(ctx, fmt.Sprintf("ListUsersResourceowner-%s", gofakeit.AppName()), gofakeit.Email())
|
||||
orgResp := Instance.CreateOrganization(ctx, integration.OrganizationName(), gofakeit.Email())
|
||||
|
||||
infos := createUsers(ctx, orgResp.OrganizationId, 3, false)
|
||||
request.Queries = []*user.SearchQuery{}
|
||||
@@ -1065,7 +1064,7 @@ func TestServer_ListUsers(t *testing.T) {
|
||||
IamCTX,
|
||||
&user.ListUsersRequest{},
|
||||
func(ctx context.Context, request *user.ListUsersRequest) userAttrs {
|
||||
orgRespForOrgTests := Instance.CreateOrganization(IamCTX, fmt.Sprintf("GetUserByIDOrg-%s", gofakeit.AppName()), gofakeit.Email())
|
||||
orgRespForOrgTests := Instance.CreateOrganization(IamCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
info := createUser(ctx, orgRespForOrgTests.OrganizationId, false)
|
||||
request.Queries = []*user.SearchQuery{}
|
||||
request.Queries = append(request.Queries, OrganizationIdQuery(orgRespForOrgTests.OrganizationId))
|
||||
@@ -1111,8 +1110,8 @@ func TestServer_ListUsers(t *testing.T) {
|
||||
IamCTX,
|
||||
&user.ListUsersRequest{},
|
||||
func(ctx context.Context, request *user.ListUsersRequest) userAttrs {
|
||||
orgRespForOrgTests := Instance.CreateOrganization(IamCTX, fmt.Sprintf("GetUserByIDOrg-%s", gofakeit.AppName()), gofakeit.Email())
|
||||
orgRespForOrgTests2 := Instance.CreateOrganization(IamCTX, fmt.Sprintf("GetUserByIDOrg-%s", gofakeit.AppName()), gofakeit.Email())
|
||||
orgRespForOrgTests := Instance.CreateOrganization(IamCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
orgRespForOrgTests2 := Instance.CreateOrganization(IamCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
// info := createUser(ctx, orgRespForOrgTests.OrganizationId, false)
|
||||
createUser(ctx, orgRespForOrgTests.OrganizationId, false)
|
||||
request.Queries = []*user.SearchQuery{}
|
||||
|
||||
@@ -641,7 +641,7 @@ func TestServer_AddHumanUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestServer_AddHumanUser_Permission(t *testing.T) {
|
||||
newOrg := Instance.CreateOrganization(IamCTX, fmt.Sprintf("AddHuman-%s", gofakeit.AppName()), gofakeit.Email())
|
||||
newOrg := Instance.CreateOrganization(IamCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
req *user.AddHumanUserRequest
|
||||
@@ -1194,7 +1194,7 @@ func TestServer_UpdateHumanUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestServer_UpdateHumanUser_Permission(t *testing.T) {
|
||||
newOrg := Instance.CreateOrganization(IamCTX, fmt.Sprintf("UpdateHuman-%s", gofakeit.AppName()), gofakeit.Email())
|
||||
newOrg := Instance.CreateOrganization(IamCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
newUserID := newOrg.CreatedAdmins[0].GetUserId()
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
@@ -1885,7 +1885,7 @@ func TestServer_AddIDPLink(t *testing.T) {
|
||||
func TestServer_StartIdentityProviderIntent(t *testing.T) {
|
||||
idpResp := Instance.AddGenericOAuthProvider(IamCTX, Instance.DefaultOrg.Id)
|
||||
orgIdpID := Instance.AddOrgGenericOAuthProvider(CTX, Instance.DefaultOrg.Id)
|
||||
orgResp := Instance.CreateOrganization(IamCTX, fmt.Sprintf("NotDefaultOrg-%s", gofakeit.AppName()), gofakeit.Email())
|
||||
orgResp := Instance.CreateOrganization(IamCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
notDefaultOrgIdpID := Instance.AddOrgGenericOAuthProvider(IamCTX, orgResp.OrganizationId)
|
||||
samlIdpID := Instance.AddSAMLProvider(IamCTX)
|
||||
samlRedirectIdpID := Instance.AddSAMLRedirectProvider(IamCTX, "")
|
||||
|
||||
Reference in New Issue
Block a user