MCPcopy
hub / github.com/cli/cli / TestHandleAdditionalPermissions

Function TestHandleAdditionalPermissions

pkg/cmd/codespace/create_test.go:727–826  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

725}
726
727func TestHandleAdditionalPermissions(t *testing.T) {
728 tests := []struct {
729 name string
730 isInteractive bool
731 accept string
732 permissionsOptOut bool
733 browserErr error
734 pollForPermissionsErr error
735 createCodespaceErr error
736 wantErr bool
737 }{
738 {
739 name: "non-interactive",
740 isInteractive: false,
741 permissionsOptOut: false,
742 wantErr: true,
743 },
744 {
745 name: "interactive, continue in browser, browser error",
746 isInteractive: true,
747 accept: "Continue in browser to review and authorize additional permissions (Recommended)",
748 permissionsOptOut: false,
749 browserErr: fmt.Errorf("browser error"),
750 wantErr: true,
751 },
752 {
753 name: "interactive, continue in browser, poll for permissions error",
754 isInteractive: true,
755 accept: "Continue in browser to review and authorize additional permissions (Recommended)",
756 permissionsOptOut: false,
757 pollForPermissionsErr: fmt.Errorf("poll for permissions error"),
758 wantErr: true,
759 },
760 {
761 name: "interactive, continue in browser, create codespace error",
762 isInteractive: true,
763 accept: "Continue in browser to review and authorize additional permissions (Recommended)",
764 permissionsOptOut: false,
765 createCodespaceErr: fmt.Errorf("create codespace error"),
766 wantErr: true,
767 },
768 {
769 name: "interactive, continue without authorizing",
770 isInteractive: true,
771 accept: "Continue without authorizing additional permissions",
772 permissionsOptOut: true,
773 createCodespaceErr: fmt.Errorf("create codespace error"),
774 wantErr: true,
775 },
776 {
777 name: "interactive, continue without authorizing, create codespace success",
778 isInteractive: true,
779 accept: "Continue without authorizing additional permissions",
780 permissionsOptOut: true,
781 },
782 }
783
784 for _, tt := range tests {

Callers

nothing calls this directly

Calls 7

TestFunction · 0.92
SetStdinTTYMethod · 0.80
SetStdoutTTYMethod · 0.80
SetStderrTTYMethod · 0.80
ErrorfMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected