Skip to content

Commit 04913ed

Browse files
ramya18101duedares-rvj
authored andcommitted
Add integration test and handle nil check
1 parent 9fae711 commit 04913ed

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

internal/cli/apps.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,14 @@ func appsSessionTransferUpdateCmd(cli *cli) *cobra.Command {
10651065
return fmt.Errorf("failed to find application with ID %q: %w", inputs.ID, err)
10661066
}
10671067

1068+
if current.SessionTransfer == nil {
1069+
current.SessionTransfer = &management.SessionTransfer{
1070+
CanCreateSessionTransferToken: auth0.Bool(false),
1071+
AllowedAuthenticationMethods: &[]string{},
1072+
EnforceDeviceBinding: auth0.String("ip"),
1073+
}
1074+
}
1075+
10681076
if err := appSTCanCreateToken.AskBoolU(cmd, &inputs.CanCreateToken, current.SessionTransfer.CanCreateSessionTransferToken); err != nil {
10691077
return err
10701078
}

test/integration/apps-test-cases.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,24 @@ tests:
292292
contains:
293293
- "Successfully set the default application to"
294294

295-
039 - given a test app, it successfully deletes the app:
295+
039 - it successfully updates the session-transfer of an application:
296+
command: auth0 apps session-transfer update $(./test/integration/scripts/get-app-id.sh) --can-create-token=true --allowed-auth-methods=cookie,query --enforce-device-binding=asn --json
297+
exit-code: 0
298+
stdout:
299+
json:
300+
can_create_session_transfer_token: "true"
301+
allowed_authentication_methods: "[cookie query]"
302+
enforce_device_binding: asn
303+
304+
040 - it successfully renders the session-transfer of an application:
305+
command: auth0 apps session-transfer show $(./test/integration/scripts/get-app-id.sh)
306+
exit-code: 0
307+
stdout:
308+
contains:
309+
- CAN CREATE TOKEN ✓
310+
- ALLOWED METHODS cookie, query
311+
- DEVICE BINDING asn
312+
313+
041 - given a test app, it successfully deletes the app:
296314
command: auth0 apps delete $(./test/integration/scripts/get-app-id.sh) --force
297315
exit-code: 0

0 commit comments

Comments
 (0)