MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / TestPromptForAccount_NoFlags

Function TestPromptForAccount_NoFlags

pkg/machinescommon/ssh_common_test.go:32–51  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30}
31
32func 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
53func TestPromptForDotNetConfig_FlagsSupplied(t *testing.T) {
54 pa := []*testutil.PA{}

Callers

nothing calls this directly

Calls 5

NewSelectPromptFunction · 0.92
NewMockAskerFunction · 0.92
NewSshCommonFlagsFunction · 0.92
NewSshCommonOptsFunction · 0.92
PromptForSshAccountFunction · 0.92

Tested by

no test coverage detected