-
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-386: Expand apps test cases and move to own test file #652
Changes from all commits
f580a65
8780785
68c54d6
b24bfe8
64516f1
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# Project artifacts | ||
/auth0 | ||
/test/integration/identifiers | ||
/coverage | ||
coverage.out | ||
|
||
# Swap | ||
[._]*.s[a-v][a-z] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ package cli | |
import ( | ||
"context" | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/pkg/browser" | ||
"github.com/spf13/cobra" | ||
|
@@ -272,6 +273,7 @@ func RunLoginAsMachine(ctx context.Context, inputs LoginInputs, cli *cli, cmd *c | |
} | ||
|
||
t := Tenant{ | ||
Name: strings.Split(inputs.Domain, ".")[0], | ||
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. This fixes a bug where all the dashboard URLs were empty when using client credentials because the name of the tenant was missing. |
||
Domain: inputs.Domain, | ||
ExpiresAt: token.ExpiresAt, | ||
ClientID: inputs.ClientID, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -272,8 +272,16 @@ func openManageURL(cli *cli, tenant string, path string) { | |
cli.renderer.Warnf("Unable to format the correct URL, please ensure you have run 'auth0 login' and try again.") | ||
return | ||
} | ||
if err := browser.OpenURL(fmt.Sprintf("%s%s", manageTenantURL, path)); err != nil { | ||
cli.renderer.Warnf("Couldn't open the URL, please do it manually: %s.", manageTenantURL) | ||
|
||
settingsURL := fmt.Sprintf("%s%s", manageTenantURL, path) | ||
|
||
if cli.noInput { | ||
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. Issue with the no input flag surfaced through the test and it is now fixed. |
||
cli.renderer.Infof("Open the following URL in a browser: %s", settingsURL) | ||
return | ||
} | ||
|
||
if err := browser.OpenURL(settingsURL); err != nil { | ||
cli.renderer.Warnf("Couldn't open the URL, please do it manually: %s", settingsURL) | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,263 @@ | ||
config: | ||
inherit-env: true | ||
|
||
tests: | ||
001 - it successfully lists all apps: | ||
command: auth0 apps list | ||
exit-code: 0 | ||
|
||
002 - it throws an error when listing all apps and passing an invalid number flag: | ||
command: auth0 apps list --number -1 | ||
exit-code: 1 | ||
stderr: | ||
contains: | ||
- "number flag invalid, please pass a number between 1 and 1000" | ||
|
||
003 - it successfully creates a native app: | ||
command: auth0 apps create --name integration-test-app-nativeapp1 --type native --description NativeApp1 | ||
exit-code: 0 | ||
stdout: | ||
contains: | ||
- NAME integration-test-app-nativeapp1 | ||
- DESCRIPTION NativeApp1 | ||
- TYPE Native | ||
|
||
004 - it successfully creates a native app and outputs in json: | ||
command: auth0 apps create --name integration-test-app-nativeapp1 --type native --description NativeApp1 --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
name: integration-test-app-nativeapp1 | ||
description: NativeApp1 | ||
app_type: native | ||
|
||
005 - it successfully creates a spa app and outputs in json: | ||
command: auth0 apps create --name integration-test-app-spaapp1 --type spa --description SpaApp1 --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
name: integration-test-app-spaapp1 | ||
description: SpaApp1 | ||
app_type: spa | ||
|
||
006 - it successfully creates a regular app and outputs in json: | ||
command: auth0 apps create --name integration-test-app-regapp1 --type regular --description RegApp1 --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
name: integration-test-app-regapp1 | ||
description: RegApp1 | ||
app_type: regular_web | ||
|
||
007 - it successfully creates a m2m app and outputs in json: | ||
command: auth0 apps create --name integration-test-app-m2mapp1 --type m2m --description M2mApp1 --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
name: integration-test-app-m2mapp1 | ||
description: M2mApp1 | ||
app_type: non_interactive | ||
|
||
008 - it successfully creates a spa app with auth method set to none and outputs in json: | ||
command: auth0 apps create --name integration-test-app-spaapp2 --type spa --description SpaApp2 --auth-method None --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
token_endpoint_auth_method: none | ||
|
||
009 - it fails to creates a m2m app with auth method set to none: | ||
command: auth0 apps create --name integration-test-app-m2mapp2 --type m2m --description M2mApp2 --auth-method None | ||
exit-code: 1 | ||
stderr: | ||
contains: | ||
- "Unable to create application" | ||
|
||
010 - it successfully creates a regular app with auth method set to post and outputs in json: | ||
command: auth0 apps create --name integration-test-app-regapp2 --type regular --description RegApp2 --auth-method Post --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
token_endpoint_auth_method: client_secret_post | ||
|
||
011 - it successfully creates a regular app with auth method set to basic and outputs in json: | ||
command: auth0 apps create --name integration-test-app-regapp3 --type regular --description RegApp3 --auth-method Basic --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
token_endpoint_auth_method: client_secret_basic | ||
|
||
012 - it successfully creates a m2m app with callbacks: | ||
command: auth0 apps create --name integration-test-app-m2mapp3 --type m2m --description M2mApp3 --callbacks https://example.com | ||
exit-code: 0 | ||
stdout: | ||
contains: | ||
- CALLBACKS https://example.com | ||
|
||
013 - it successfully creates a regular app with callbacks and outputs in json: | ||
command: auth0 apps create --name integration-test-app-regapp4 --type regular --description RegApp4 --callbacks https://example.com,https://google.com --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
callbacks: "[https://example.com https://google.com]" | ||
|
||
014 - it successfully creates a regular app with grants: | ||
command: auth0 apps create --name integration-test-app-regapp5 --type regular --description RegApp4 --grants credentials,password | ||
exit-code: 0 | ||
stdout: | ||
contains: | ||
- GRANTS client_credentials, password | ||
|
||
015 - it successfully creates a spa app with grants and outputs in json: | ||
command: auth0 apps create --name integration-test-app-spaapp3 --type spa --description SpaApp3 --grants refresh-token --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
grant_types: "[refresh_token]" | ||
|
||
016 - it successfully creates a native app with grants and outputs in json: | ||
command: auth0 apps create --name integration-test-app-nativeapp2 --type native --description NativeApp2 --grants refresh-token,code --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
grant_types: "[refresh_token authorization_code]" | ||
|
||
017 - it fails to create a m2m app with device code grant: | ||
command: auth0 apps create --name integration-test-app-m2mapp4 --type m2m --description M2mApp4 --grants credentials,device-code | ||
exit-code: 1 | ||
stderr: | ||
contains: | ||
- "Unable to create application" | ||
|
||
018 - it successfully creates a native app with logout urls and outputs in json: | ||
command: auth0 apps create --name integration-test-app-regapp6 --type native --description RegularApp --logout-urls https://*.example.com/logout,https://example.com/logout --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
allowed_logout_urls: "[https://*.example.com/logout https://example.com/logout]" | ||
|
||
019 - it successfully creates a native app with origins and outputs in json: | ||
command: auth0 apps create --name integration-test-app-regapp7 --type native --description RegularApp --origins https://*.example.com,https://example.com --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
allowed_origins: "[https://*.example.com https://example.com]" | ||
|
||
020 - it successfully creates a native app with web origins and outputs in json: | ||
command: auth0 apps create --name integration-test-app-spaapp4 --type native --description SpaApp4 --web-origins https://example.com --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
web_origins: "[https://example.com]" | ||
|
||
021 - given a test app: | ||
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. Should this be a test case? 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. We need some way to assert that the app used in the below steps is created, otherwise they will all fail. Not the perfect solution unfortunately, as we're quite limited by this commander test runner. Long term I'd love for us to get rid of this way of testing and take https://github.com/cli/cli/blob/trunk/pkg/cmd/issue/list/list_test.go as an example instead. |
||
command: ./test/integration/scripts/get-app-id.sh | ||
exit-code: 0 | ||
|
||
022 - given a test app, it successfully gets the app's details and outputs in json: | ||
command: auth0 apps show $(cat ./test/integration/identifiers/app-id) --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
name: integration-test-app-newapp | ||
description: NewApp | ||
app_type: native | ||
|
||
023 - given a test app, it successfully gets the app's details: | ||
command: auth0 apps show $(cat ./test/integration/identifiers/app-id) | ||
exit-code: 0 | ||
stdout: | ||
contains: | ||
- NAME integration-test-app-newapp | ||
- DESCRIPTION NewApp | ||
- TYPE Native | ||
|
||
024 - given a test app, it successfully updates the app's auth method and outputs in json: | ||
command: auth0 apps update $(cat ./test/integration/identifiers/app-id) --auth-method Basic --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
token_endpoint_auth_method: client_secret_basic | ||
|
||
025 - given a test app, it successfully updates the app's callbacks and outputs in json: | ||
command: auth0 apps update $(cat ./test/integration/identifiers/app-id) --callbacks https://example.com --json | ||
stdout: | ||
json: | ||
callbacks: "[https://example.com]" | ||
exit-code: 0 | ||
|
||
026 - given a test app, it successfully updates the app's description and outputs in json: | ||
command: auth0 apps update $(cat ./test/integration/identifiers/app-id) --description "A better description" --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
description: A better description | ||
|
||
027 - given a test app, it successfully updates the app's grants and outputs in json: | ||
command: auth0 apps update $(cat ./test/integration/identifiers/app-id) --grants code --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
grant_types: "[authorization_code]" | ||
|
||
028 - given a test app, it successfully updates the app's logout urls and outputs in json: | ||
command: auth0 apps update $(cat ./test/integration/identifiers/app-id) --logout-urls https://example.com --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
allowed_logout_urls: "[https://example.com]" | ||
|
||
029 - given a test app, it successfully updates the app's name and outputs in json: | ||
command: auth0 apps update $(cat ./test/integration/identifiers/app-id) --name integration-test-app-betterAppName --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
name: integration-test-app-betterAppName | ||
|
||
030 - given a test app, it successfully updates the app's origins and outputs in json: | ||
command: auth0 apps update $(cat ./test/integration/identifiers/app-id) --origins https://example.com --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
allowed_origins: "[https://example.com]" | ||
|
||
031 - given a test app, it successfully updates the app's type and outputs in json: | ||
command: auth0 apps update $(cat ./test/integration/identifiers/app-id) --type spa --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
app_type: spa | ||
|
||
032 - given a test app, it successfully updates the app's web origins and outputs in json: | ||
command: auth0 apps update $(cat ./test/integration/identifiers/app-id) --web-origins https://example.com --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
web_origins: "[https://example.com]" | ||
|
||
033 - given a test app, it successfully updates the app's web origins and type and outputs in json: | ||
command: auth0 apps update $(cat ./test/integration/identifiers/app-id) --web-origins https://examples.com --type native --json | ||
exit-code: 0 | ||
stdout: | ||
json: | ||
app_type: native | ||
web_origins: "[https://examples.com]" | ||
|
||
034 - given a test app, it successfully opens the settings page: | ||
command: auth0 apps open $(cat ./test/integration/identifiers/app-id) --no-input | ||
exit-code: 0 | ||
stderr: | ||
contains: | ||
- "Open the following URL in a browser" | ||
|
||
|
||
035 - given a test app, it successfully sets the default application: | ||
command: auth0 apps use $(cat ./test/integration/identifiers/app-id) --no-input | ||
exit-code: 0 | ||
stderr: | ||
contains: | ||
- "Successfully set the default application to" | ||
|
||
|
||
036 - given a test app, it successfully deletes the app: | ||
command: auth0 apps delete $(cat ./test/integration/identifiers/app-id) --force | ||
exit-code: 0 |
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.
These will be used later when adding the coverage badge on the README.