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

Function TestLogout_SetsConfigCorrectly

pkg/cmd/logout/logout_test.go:15–40  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestLogout_SetsConfigCorrectly(t *testing.T) {
16 api := testutil.NewMockHttpServer()
17 fac := testutil.NewMockFactory(api)
18
19 configProvider, err := fac.GetConfigProvider()
20
21 assert.Nil(t, err)
22
23 configProvider.Set(constants.ConfigUrl, "https://some.octopus.app")
24 configProvider.Set(constants.ConfigApiKey, "API-APIKEY01")
25 configProvider.Set(constants.ConfigUrl, "accesstoken")
26
27 logoutCmd := logoutCmd.NewCmdLogout(fac)
28 stdout, stderr := &bytes.Buffer{}, &bytes.Buffer{}
29 logoutCmd.SetOut(stdout)
30 logoutCmd.SetErr(stderr)
31 cmdReceiver := testutil.GoBegin2(func() (*cobra.Command, error) {
32 return logoutCmd.ExecuteC()
33 })
34
35 _, err = testutil.ReceivePair(cmdReceiver)
36 assert.Nil(t, err)
37 assert.Empty(t, viper.GetString(constants.ConfigUrl))
38 assert.Empty(t, viper.GetString(constants.ConfigApiKey))
39 assert.Empty(t, viper.GetString(constants.ConfigAccessToken))
40}

Callers

nothing calls this directly

Calls 6

GetConfigProviderMethod · 0.95
NewMockHttpServerFunction · 0.92
NewMockFactoryFunction · 0.92
GoBegin2Function · 0.92
ReceivePairFunction · 0.92
SetMethod · 0.65

Tested by

no test coverage detected