diff --git a/internal/cli/universal_login_customize_test.go b/internal/cli/universal_login_customize_test.go index 8f379d018..e1703063f 100644 --- a/internal/cli/universal_login_customize_test.go +++ b/internal/cli/universal_login_customize_test.go @@ -1181,6 +1181,89 @@ func TestFetchUniversalLoginBrandingData(t *testing.T) { }, expectedError: "failed to fetch custom text", }, + { + name: "it fails to fetch branding data if there's an error retrieving client data", + mockedAPI: func() *auth0.API { + mockBrandingAPI := mock.NewMockBrandingAPI(ctrl) + mockBrandingAPI. + EXPECT(). + Read(gomock.Any()). + Return( + &management.Branding{ + Colors: &management.BrandingColors{ + Primary: auth0.String("#334455"), + PageBackground: auth0.String("#00AABB"), + }, + LogoURL: auth0.String("https://some-log.example.com"), + }, + nil, + ) + + mockBrandingAPI. + EXPECT(). + UniversalLogin(gomock.Any()). + Return( + &management.BrandingUniversalLogin{ + Body: auth0.String(""), + }, + nil, + ) + + mockBrandingThemeAPI := mock.NewMockBrandingThemeAPI(ctrl) + mockBrandingThemeAPI. + EXPECT(). + Default(gomock.Any()). + Return(&management.BrandingTheme{}, nil) + + mockTenantAPI := mock.NewMockTenantAPI(ctrl) + mockTenantAPI. + EXPECT(). + Read(gomock.Any()). + Return( + &management.Tenant{ + FriendlyName: auth0.String("My Test Tenant"), + EnabledLocales: &[]string{"en", "es"}, + }, + nil, + ) + + mockPromptAPI := mock.NewMockPromptAPI(ctrl) + mockPromptAPI. + EXPECT(). + CustomText(gomock.Any(), "login", "en"). + Return( + map[string]interface{}{ + "login": map[string]interface{}{ + "title": "Welcome friend, glad to have you!", + }, + }, + nil, + ) + for _, promptType := range allowedPromptsWithPartials { + mockPromptAPI.EXPECT(). + ReadPartials(gomock.Any(), promptType). + Return(&management.PromptPartials{ + FormContentStart: "