mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 07:57:32 +00:00
chore: improve integration tests (#8727)
Improve integration tests:
- spliting the tests in TokenExchange to isolated instances and in
parallel
- corrected some test structure so that the check for Details is no done
anymore if the test already failed
- replace required-calls with assert-calls to not stop the testing
- add gofakeit for application, project and usernames(emails)
- add eventually checks for testing in actions v2, so the request only
get called when the execution is defined
- check for length of results in list/search endpoints to avoid index
errors
(cherry picked from commit 8d97363642
)
This commit is contained in:

committed by
Livio Spring

parent
b6fad5ac83
commit
63a9312a8e
@@ -4,11 +4,11 @@ package org_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/brianvoe/gofakeit/v6"
|
||||
"github.com/muhlemmer/gu"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -72,7 +72,7 @@ func TestServer_AddOrganization(t *testing.T) {
|
||||
name: "invalid admin type",
|
||||
ctx: CTX,
|
||||
req: &org.AddOrganizationRequest{
|
||||
Name: fmt.Sprintf("%d", time.Now().UnixNano()),
|
||||
Name: gofakeit.AppName(),
|
||||
Admins: []*org.AddOrganizationRequest_Admin{
|
||||
{},
|
||||
},
|
||||
@@ -83,7 +83,7 @@ func TestServer_AddOrganization(t *testing.T) {
|
||||
name: "admin with init",
|
||||
ctx: CTX,
|
||||
req: &org.AddOrganizationRequest{
|
||||
Name: fmt.Sprintf("%d", time.Now().UnixNano()),
|
||||
Name: gofakeit.AppName(),
|
||||
Admins: []*org.AddOrganizationRequest_Admin{
|
||||
{
|
||||
UserType: &org.AddOrganizationRequest_Admin_Human{
|
||||
@@ -93,7 +93,7 @@ func TestServer_AddOrganization(t *testing.T) {
|
||||
FamilyName: "lastname",
|
||||
},
|
||||
Email: &user_v2beta.SetHumanEmail{
|
||||
Email: fmt.Sprintf("%d@mouse.com", time.Now().UnixNano()),
|
||||
Email: gofakeit.Email(),
|
||||
Verification: &user_v2beta.SetHumanEmail_ReturnCode{
|
||||
ReturnCode: &user_v2beta.ReturnEmailVerificationCode{},
|
||||
},
|
||||
@@ -118,7 +118,7 @@ func TestServer_AddOrganization(t *testing.T) {
|
||||
name: "existing user and new human with idp",
|
||||
ctx: CTX,
|
||||
req: &org.AddOrganizationRequest{
|
||||
Name: fmt.Sprintf("%d", time.Now().UnixNano()),
|
||||
Name: gofakeit.AppName(),
|
||||
Admins: []*org.AddOrganizationRequest_Admin{
|
||||
{
|
||||
UserType: &org.AddOrganizationRequest_Admin_UserId{UserId: User.GetUserId()},
|
||||
@@ -131,7 +131,7 @@ func TestServer_AddOrganization(t *testing.T) {
|
||||
FamilyName: "lastname",
|
||||
},
|
||||
Email: &user_v2beta.SetHumanEmail{
|
||||
Email: fmt.Sprintf("%d@mouse.com", time.Now().UnixNano()),
|
||||
Email: gofakeit.Email(),
|
||||
Verification: &user_v2beta.SetHumanEmail_IsVerified{
|
||||
IsVerified: true,
|
||||
},
|
||||
|
Reference in New Issue
Block a user