Skip to content

Commit

Permalink
Updated testcase for TestTenantManager
Browse files Browse the repository at this point in the history
  • Loading branch information
developerkunal committed Aug 13, 2024
1 parent 734ed02 commit a284bd8
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 10 deletions.
26 changes: 26 additions & 0 deletions management/tenant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,32 @@ func TestTenantManager(t *testing.T) {
assert.Equal(t, newTenantSettings.GetAcrValuesSupported(), actualTenantSettings.GetAcrValuesSupported())
assert.Equal(t, newTenantSettings.GetPushedAuthorizationRequestsSupported(), actualTenantSettings.GetPushedAuthorizationRequestsSupported())
assert.Equal(t, newTenantSettings.GetMTLS().GetEnableEndpointAliases(), actualTenantSettings.GetMTLS().GetEnableEndpointAliases())

// If AcrValuesSupported and MTLS is not Passed Should not change the values.
updatedNewTenant := &Tenant{
MTLS: nil,
AcrValuesSupported: nil,
FriendlyName: auth0.String("My Example Tenant"),
}
err = api.Tenant.Update(context.Background(), updatedNewTenant)
assert.NoError(t, err)

newActualTenantSettings, err := api.Tenant.Read(context.Background())
assert.NoError(t, err)
assert.Equal(t, newActualTenantSettings.GetFriendlyName(), actualTenantSettings.GetFriendlyName())
assert.Equal(t, newActualTenantSettings.GetIdleSessionLifetime(), actualTenantSettings.GetIdleSessionLifetime())
assert.Equal(t, newActualTenantSettings.GetIdleSessionLifetime(), 720.0) // it got rounded off
assert.Equal(t, newActualTenantSettings.GetSessionLifetime(), actualTenantSettings.GetSessionLifetime())
assert.Equal(t, newActualTenantSettings.GetSupportEmail(), actualTenantSettings.GetSupportEmail())
assert.Equal(t, newActualTenantSettings.GetSupportURL(), actualTenantSettings.GetSupportURL())
assert.Equal(t, newActualTenantSettings.GetSessionCookie().GetMode(), actualTenantSettings.GetSessionCookie().GetMode())
assert.Equal(t, newActualTenantSettings.GetAllowedLogoutURLs(), actualTenantSettings.GetAllowedLogoutURLs())
assert.Equal(t, newActualTenantSettings.GetEnabledLocales(), actualTenantSettings.GetEnabledLocales())
assert.Equal(t, newActualTenantSettings.GetSandboxVersion(), actualTenantSettings.GetSandboxVersion())
assert.Equal(t, newActualTenantSettings.GetSessions().GetOIDCLogoutPromptEnabled(), actualTenantSettings.GetSessions().GetOIDCLogoutPromptEnabled())
assert.Equal(t, newActualTenantSettings.GetAcrValuesSupported(), actualTenantSettings.GetAcrValuesSupported())
assert.Equal(t, newActualTenantSettings.GetPushedAuthorizationRequestsSupported(), actualTenantSettings.GetPushedAuthorizationRequestsSupported())
assert.Equal(t, newActualTenantSettings.GetMTLS().GetEnableEndpointAliases(), actualTenantSettings.GetMTLS().GetEnableEndpointAliases())
}

func TestTenantManager_NullableFields(t *testing.T) {
Expand Down
Loading

0 comments on commit a284bd8

Please sign in to comment.