diff --git a/commander.yaml b/commander.yaml index 2c96c66ce..f0456f17a 100644 --- a/commander.yaml +++ b/commander.yaml @@ -374,3 +374,56 @@ tests: json: allow_offline_access: "false" exit-code: 0 + + # Test 'users create' + users create and check data: + command: auth0 users create --name integration-test-user-new --connection Username-Password-Authentication --email testuser@example.com --password testUser12 --format json --no-input + exit-code: 0 + stdout: + json: + Email: "testuser@example.com" + Connection: "Username-Password-Authentication" + + users create and check output: + command: auth0 users create --name integration-test-user-new2 --connection Username-Password-Authentication --email testuser2@example.com --password testUser12 --no-input + exit-code: 0 + stdout: + contains: + - EMAIL testuser2@example.com + - CONNECTION Username-Password-Authentication + + # Test 'users show' + users create test user: + command: ./integration/get-user-id.sh + exit-code: 0 + + users show json: + command: auth0 users show $(cat ./integration/identifiers/user-id) --format json + stdout: + json: + Email: "newuser@example.com" + Connection: "Username-Password-Authentication" + exit-code: 0 + + users show: + command: auth0 users show $(cat ./integration/identifiers/user-id) + stdout: + contains: + - EMAIL newuser@example.com + - CONNECTION Username-Password-Authentication + exit-code: 0 + + # Test 'users update' + users update email: + command: auth0 users update $(cat ./integration/identifiers/user-id) --email betteruser@example.com --format json --no-input + stdout: + json: + Email: betteruser@example.com + exit-code: 0 + + users update name: + command: auth0 users update $(cat ./integration/identifiers/user-id) --name integration-test-user-bettername --format json --no-input + stdout: + json: + Email: betteruser@example.com # Name is not being displayed, hence using email + exit-code: 0 \ No newline at end of file diff --git a/integration/get-user-id.sh b/integration/get-user-id.sh new file mode 100755 index 000000000..dfbd253a0 --- /dev/null +++ b/integration/get-user-id.sh @@ -0,0 +1,6 @@ +#! /bin/bash + +user=$( auth0 users create -n integration-test-user-better -c Username-Password-Authentication -e newuser@example.com -p testUser12 --format json --no-input ) + +mkdir -p ./integration/identifiers +echo "$user" | jq -r '.["UserID"]' > ./integration/identifiers/user-id diff --git a/integration/test-cleanup.sh b/integration/test-cleanup.sh index 499b17be2..d09dc2420 100755 --- a/integration/test-cleanup.sh +++ b/integration/test-cleanup.sh @@ -35,3 +35,20 @@ for api in $( echo "${apis}" | jq -r '.[] | @base64' ); do $( auth0 apis delete "$id") fi done + +# using the search command since users have no list command +users=$( auth0 users search -q "*" --format json --no-input ) + +for user in $( echo "${users}" | jq -r '.[] | @base64' ); do + _jq() { + echo "${user}" | base64 --decode | jq -r "${1}" + } + + userid=$(_jq '.UserID') + # created during the same test session + if [[ integration-* ]] + then + echo deleting "$userid" + $( auth0 users delete "$userid") + fi +done \ No newline at end of file diff --git a/pkg/auth0-cli-config-generator/main.go b/pkg/auth0-cli-config-generator/main.go index 6d8bef902..b38ae06bc 100644 --- a/pkg/auth0-cli-config-generator/main.go +++ b/pkg/auth0-cli-config-generator/main.go @@ -28,15 +28,17 @@ type params struct { } var requiredScopes = []string{ - // "openid", - // "offline_access", // <-- to get a refresh token. + //"openid", + //"offline_access", // <-- to get a refresh token. "create:clients", "delete:clients", "read:clients", "update:clients", "create:resource_servers", "delete:resource_servers", "read:resource_servers", "update:resource_servers", + "create:roles", "delete:roles", "read:roles", "update:roles", "create:rules", "delete:rules", "read:rules", "update:rules", - "read:client_keys", "read:logs", "read:connections", "update:connections", "create:users", "delete:users", "read:users", "update:users", "read:branding", "update:branding", + "read:connections", "update:connections", "read:client_keys", "read:logs", "read:tenant_settings", "read:custom_domains", + "read:anomaly_blocks", "delete:anomaly_blocks", } func (p params) validate() error {