Skip to content

Commit

Permalink
DXCDT-386: Make api test cases more robust (#665)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiught authored Mar 8, 2023
1 parent db00760 commit 855584d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 25 deletions.
31 changes: 31 additions & 0 deletions test/integration/api-test-cases.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
config:
inherit-env: true

tests:
001 - it successfully uses the api command to fetch tenant settings:
command: auth0 api get "tenants/settings" --query "include_fields=true" --query "fields=idle_session_lifetime"
exit-code: 0
stdout:
contains:
- "idle_session_lifetime"

002 - it successfully uses the api command to patch tenant settings with piped data:
command: cat ./test/integration/fixtures/update-tenant-settings.json | auth0 api patch "tenants/settings" && auth0 api get "tenants/settings" --query "include_fields=true" --query "fields=idle_session_lifetime"
exit-code: 0
stdout:
json:
idle_session_lifetime: "73"

003 - it successfully uses the api command to patch tenant settings:
command: auth0 api patch "tenants/settings" --data "{\"idle_session_lifetime\":72}" && auth0 api get "tenants/settings" --query "include_fields=true" --query "fields=idle_session_lifetime"
exit-code: 0
stdout:
json:
idle_session_lifetime: "72"

004 - it fails to use the api command to patch tenant settings with invalid json:
command: auth0 api patch "tenants/settings" --data "{\"idle_session_lifetime:72}"
exit-code: 1
stderr:
contains:
- "failed to parse command inputs: invalid json data given"
25 changes: 0 additions & 25 deletions test/integration/test-cases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -405,31 +405,6 @@ tests:
- STAGE_PRE_USER_REGISTRATION_RATE
exit-code: 0

api get tenant settings:
command: auth0 api get "tenants/settings"
stdout:
json:
enabled_locales.#: "1"
exit-code: 0

api patch tenant settings with piped data:
command: cat ./test/integration/fixtures/update-tenant-settings.json | auth0 api patch "tenants/settings"
stdout:
json:
idle_session_lifetime: "73"
exit-code: 0

api patch tenant settings:
command: auth0 api patch "tenants/settings" --data "{\"idle_session_lifetime\":72}"
stdout:
json:
idle_session_lifetime: "72"
exit-code: 0

api patch tenant settings with wrong json:
command: auth0 api patch "tenants/settings" --data "{\"idle_session_lifetime:72}"
exit-code: 1

create organization and check json output:
command: auth0 orgs create --name integration-test-org-new --display "Integration Test Organization" --json --no-input
exit-code: 0
Expand Down

0 comments on commit 855584d

Please sign in to comment.