(t *testing.T)
| 30 | } |
| 31 | |
| 32 | func TestPromptForAccount_NoFlags(t *testing.T) { |
| 33 | pa := []*testutil.PA{ |
| 34 | testutil.NewSelectPrompt("Select the account to use\n", "", []string{"SSH keypair account", "Username account"}, "Username account"), |
| 35 | } |
| 36 | |
| 37 | asker, checkRemainingPrompts := testutil.NewMockAsker(t, pa) |
| 38 | flags := machinescommon.NewSshCommonFlags() |
| 39 | |
| 40 | opts := machinescommon.NewSshCommonOpts(&cmd.Dependencies{Ask: asker}) |
| 41 | opts.GetAllAccountsForSshMachine = func() ([]accounts.IAccount, error) { |
| 42 | ssh, _ := accounts.NewSSHKeyAccount("SSH keypair account", "username", core.NewSensitiveValue("cert")) |
| 43 | username, _ := accounts.NewUsernamePasswordAccount("Username account") |
| 44 | return []accounts.IAccount{ssh, username}, nil |
| 45 | } |
| 46 | |
| 47 | err := machinescommon.PromptForSshAccount(opts, flags) |
| 48 | checkRemainingPrompts() |
| 49 | assert.NoError(t, err) |
| 50 | assert.Equal(t, "Username account", flags.Account.Value) |
| 51 | } |
| 52 | |
| 53 | func TestPromptForDotNetConfig_FlagsSupplied(t *testing.T) { |
| 54 | pa := []*testutil.PA{} |
nothing calls this directly
no test coverage detected