(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func 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 | } |
nothing calls this directly
no test coverage detected