-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DXCDT-416: Add tests for updating universal login branding #692
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,7 +178,7 @@ func updateUniversalLoginCmd(cli *cli) *cobra.Command { | |
b := &management.Branding{} | ||
isAccentColorSet := len(inputs.AccentColor) > 0 | ||
isBackgroundColorSet := len(inputs.BackgroundColor) > 0 | ||
currentHasColors := current.Colors != nil | ||
currentHasColors := current.GetColors() != nil | ||
|
||
if isAccentColorSet || isBackgroundColorSet || currentHasColors { | ||
b.Colors = &management.BrandingColors{} | ||
|
@@ -196,15 +196,11 @@ func updateUniversalLoginCmd(cli *cli) *cobra.Command { | |
} | ||
} | ||
|
||
if len(inputs.LogoURL) == 0 { | ||
b.LogoURL = current.LogoURL | ||
} else { | ||
if len(inputs.LogoURL) != 0 { | ||
b.LogoURL = &inputs.LogoURL | ||
} | ||
|
||
if len(inputs.FaviconURL) == 0 { | ||
b.FaviconURL = current.FaviconURL | ||
} else { | ||
if len(inputs.FaviconURL) != 0 { | ||
b.FaviconURL = &inputs.FaviconURL | ||
} | ||
|
||
|
@@ -213,14 +209,6 @@ func updateUniversalLoginCmd(cli *cli) *cobra.Command { | |
b.Font = &management.BrandingFont{URL: &inputs.CustomFontURL} | ||
} | ||
|
||
if b.Font != nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From testing, this code is not required. The only case where Given that, we will always repeat exactly what the if statement on 212 achieves, i.e. if a |
||
if len(inputs.CustomFontURL) == 0 { | ||
b.Font.URL = current.Font.URL | ||
} else { | ||
b.Font.URL = &inputs.CustomFontURL | ||
} | ||
} | ||
|
||
// Update branding | ||
if err := ansi.Waiting(func() error { | ||
return cli.api.Branding.Update(b) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
config: | ||
inherit-env: true | ||
|
||
tests: | ||
001 - sets default expected values: | ||
command: auth0 ul update --accent "#2A2E35" --background "#FF4F40" --logo "https://example.com/logo.png" --favicon "https://example.com/favicon.png" --font https://example.com/font.woff --no-input | ||
exit-code: 0 | ||
|
||
002 - it successfully shows universal login branding: | ||
command: auth0 ul show | ||
exit-code: 0 | ||
stdout: | ||
contains: | ||
- ACCENT COLOR #2A2E35 | ||
- BACKGROUND COLOR #FF4F40 | ||
ewanharris marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- LOGO URL https://example.com/logo.png | ||
- FAVICON URL https://example.com/favicon.png | ||
- CUSTOM FONT URL https://example.com/font.woff | ||
|
||
003 - it successfully shows universal login branding in json: | ||
command: auth0 ul show --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
colors.primary: "#2A2E35" | ||
colors.page_background: "#FF4F40" | ||
favicon_url: "https://example.com/favicon.png" | ||
logo_url: "https://example.com/logo.png" | ||
font.url: "https://example.com/font.woff" | ||
|
||
004 - it successfully updates universal login branding: | ||
command: auth0 ul update --accent "#2A2E35" --background "#FF4F40" --logo "https://example.com/logo-updated.png" --favicon "https://example.com/favicon-updated.png" --font https://example.com/font-updated.woff | ||
exit-code: 0 | ||
stdout: | ||
contains: | ||
- ACCENT COLOR #2A2E35 | ||
- BACKGROUND COLOR #FF4F40 | ||
ewanharris marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- LOGO URL https://example.com/logo-updated.png | ||
- FAVICON URL https://example.com/favicon-updated.png | ||
- CUSTOM FONT URL https://example.com/font-updated.woff | ||
|
||
005 - it successfully updates universal login branding and outputs as json: | ||
command: auth0 ul update --accent "#FF4F40" --background "#2A2E35" --logo "https://example.com/logo-updated-json.png" --favicon "https://example.com/favicon-updated-json.png" --font https://example.com/font-updated-json.woff --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
colors.primary: "#FF4F40" | ||
colors.page_background: "#2A2E35" | ||
favicon_url: "https://example.com/favicon-updated-json.png" | ||
logo_url: "https://example.com/logo-updated-json.png" | ||
font.url: "https://example.com/font-updated-json.woff" | ||
|
||
006 - it successfully updates universal login branding and persists previous colors: | ||
command: auth0 ul update --logo "https://example.com/logo-updated-2.png" --favicon "https://example.com/favicon-updated-2.png" --font https://example.com/font-updated-2.woff --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
colors.primary: "#FF4F40" | ||
colors.page_background: "#2A2E35" | ||
favicon_url: "https://example.com/favicon-updated-2.png" | ||
logo_url: "https://example.com/logo-updated-2.png" | ||
font.url: "https://example.com/font-updated-2.woff" | ||
|
||
007 - it successfully updates universal login branding and persists previous URLs: | ||
command: auth0 ul update --accent "#2A2E35" --background "#FF4F40" --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
colors.primary: "#2A2E35" | ||
colors.page_background: "#FF4F40" | ||
favicon_url: "https://example.com/favicon-updated-2.png" | ||
logo_url: "https://example.com/logo-updated-2.png" | ||
font.url: "https://example.com/font-updated-2.woff" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this error is solely for a new tenant/tenant that hasn't touched the values (due to this API being a PATCH API so it's difficult to reset the values)
But on first run of
auth0 ul
in my tenant I got the below error, this repeated for LogoURL and FaviconURL, looking at the API calls in the UI aGET /api/v2/branding
only returned a subset of data{"colors":{"primary":"#FF4F40"}}
rather than a full object