mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-17 19:05:13 +00:00
chore: move gofakeit integration testing calls (#10684)
# Which Problems Are Solved Flakiness and conflicts in value from gofakeit. # How the Problems Are Solved Move Gofakeit calls to the integration package, to guarantee proper usage and values for integration testing. # Additional Changes None # Additional Context None
This commit is contained in:
@@ -10,7 +10,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/brianvoe/gofakeit/v6"
|
||||
"github.com/muhlemmer/gu"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -641,7 +640,7 @@ func TestServer_AddHumanUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestServer_AddHumanUser_Permission(t *testing.T) {
|
||||
newOrg := Instance.CreateOrganization(IamCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
newOrg := Instance.CreateOrganization(IamCTX, integration.OrganizationName(), integration.Email())
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
req *user.AddHumanUserRequest
|
||||
@@ -868,7 +867,7 @@ func TestServer_UpdateHumanUser(t *testing.T) {
|
||||
args: args{
|
||||
CTX,
|
||||
&user.UpdateHumanUserRequest{
|
||||
Username: gu.Ptr(gofakeit.Username()),
|
||||
Username: gu.Ptr(integration.Username()),
|
||||
},
|
||||
},
|
||||
want: &user.UpdateHumanUserResponse{
|
||||
@@ -1194,7 +1193,7 @@ func TestServer_UpdateHumanUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestServer_UpdateHumanUser_Permission(t *testing.T) {
|
||||
newOrg := Instance.CreateOrganization(IamCTX, integration.OrganizationName(), gofakeit.Email())
|
||||
newOrg := Instance.CreateOrganization(IamCTX, integration.OrganizationName(), integration.Email())
|
||||
newUserID := newOrg.CreatedAdmins[0].GetUserId()
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
@@ -1212,7 +1211,7 @@ func TestServer_UpdateHumanUser_Permission(t *testing.T) {
|
||||
SystemCTX,
|
||||
&user.UpdateHumanUserRequest{
|
||||
UserId: newUserID,
|
||||
Username: gu.Ptr(gofakeit.Username()),
|
||||
Username: gu.Ptr(integration.Username()),
|
||||
},
|
||||
},
|
||||
want: &user.UpdateHumanUserResponse{
|
||||
@@ -1228,7 +1227,7 @@ func TestServer_UpdateHumanUser_Permission(t *testing.T) {
|
||||
IamCTX,
|
||||
&user.UpdateHumanUserRequest{
|
||||
UserId: newUserID,
|
||||
Username: gu.Ptr(gofakeit.Username()),
|
||||
Username: gu.Ptr(integration.Username()),
|
||||
},
|
||||
},
|
||||
want: &user.UpdateHumanUserResponse{
|
||||
@@ -1244,7 +1243,7 @@ func TestServer_UpdateHumanUser_Permission(t *testing.T) {
|
||||
CTX,
|
||||
&user.UpdateHumanUserRequest{
|
||||
UserId: newUserID,
|
||||
Username: gu.Ptr(gofakeit.Username()),
|
||||
Username: gu.Ptr(integration.Username()),
|
||||
},
|
||||
},
|
||||
wantErr: true,
|
||||
@@ -1255,7 +1254,7 @@ func TestServer_UpdateHumanUser_Permission(t *testing.T) {
|
||||
UserCTX,
|
||||
&user.UpdateHumanUserRequest{
|
||||
UserId: newUserID,
|
||||
Username: gu.Ptr(gofakeit.Username()),
|
||||
Username: gu.Ptr(integration.Username()),
|
||||
},
|
||||
},
|
||||
wantErr: true,
|
||||
@@ -1708,7 +1707,7 @@ func TestServer_ReactivateUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestServer_DeleteUser(t *testing.T) {
|
||||
projectResp := Instance.CreateProject(CTX, t, "", gofakeit.AppName(), false, false)
|
||||
projectResp := Instance.CreateProject(CTX, t, Instance.DefaultOrg.GetId(), integration.ProjectName(), false, false)
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
req *user.DeleteUserRequest
|
||||
@@ -1773,7 +1772,7 @@ func TestServer_DeleteUser(t *testing.T) {
|
||||
prepare: func(request *user.DeleteUserRequest) {
|
||||
resp := Instance.CreateHumanUser(CTX)
|
||||
request.UserId = resp.GetUserId()
|
||||
Instance.CreateProjectUserGrant(t, CTX, projectResp.GetId(), request.UserId)
|
||||
Instance.CreateProjectUserGrant(t, CTX, Instance.DefaultOrg.GetId(), projectResp.GetId(), request.UserId)
|
||||
Instance.CreateProjectMembership(t, CTX, projectResp.GetId(), request.UserId)
|
||||
Instance.CreateOrgMembership(t, CTX, Instance.DefaultOrg.Id, request.UserId)
|
||||
},
|
||||
@@ -1885,7 +1884,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, integration.OrganizationName(), gofakeit.Email())
|
||||
orgResp := Instance.CreateOrganization(IamCTX, integration.OrganizationName(), integration.Email())
|
||||
notDefaultOrgIdpID := Instance.AddOrgGenericOAuthProvider(IamCTX, orgResp.OrganizationId)
|
||||
samlIdpID := Instance.AddSAMLProvider(IamCTX)
|
||||
samlRedirectIdpID := Instance.AddSAMLRedirectProvider(IamCTX, "")
|
||||
@@ -2157,8 +2156,8 @@ func TestServer_StartIdentityProviderIntent(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestServer_RetrieveIdentityProviderIntent(t *testing.T) {
|
||||
oauthIdpID := Instance.AddGenericOAuthProvider(IamCTX, gofakeit.AppName()).GetId()
|
||||
oidcIdpID := Instance.AddGenericOIDCProvider(IamCTX, gofakeit.AppName()).GetId()
|
||||
oauthIdpID := Instance.AddGenericOAuthProvider(IamCTX, integration.IDPName()).GetId()
|
||||
oidcIdpID := Instance.AddGenericOIDCProvider(IamCTX, integration.IDPName()).GetId()
|
||||
samlIdpID := Instance.AddSAMLPostProvider(IamCTX)
|
||||
ldapIdpID := Instance.AddLDAPProvider(IamCTX)
|
||||
authURL, err := url.Parse(Instance.CreateIntent(CTX, oauthIdpID).GetAuthUrl())
|
||||
|
||||
Reference in New Issue
Block a user