MCPcopy
hub / github.com/cli/cli / TestDefaultHostLoggedInToOnlyOneHost

Function TestDefaultHostLoggedInToOnlyOneHost

internal/config/auth_config_test.go:224–236  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

222}
223
224func TestDefaultHostLoggedInToOnlyOneHost(t *testing.T) {
225 // Given we are logged into one host (not github.com to differentiate from the fallback)
226 authCfg := newTestAuthConfig(t)
227 _, err := authCfg.Login("ghe.io", "test-user", "test-token", "", false)
228 require.NoError(t, err)
229
230 // When we get the DefaultHost
231 defaultHost, source := authCfg.DefaultHost()
232
233 // Then the returned host is that logged in host and the source is the hosts config
234 require.Equal(t, "ghe.io", defaultHost)
235 require.Equal(t, hostsKey, source)
236}
237
238func TestLoginSecureStorageUsesKeyring(t *testing.T) {
239 // Given a usable keyring

Callers

nothing calls this directly

Calls 4

newTestAuthConfigFunction · 0.85
EqualMethod · 0.80
LoginMethod · 0.65
DefaultHostMethod · 0.65

Tested by

no test coverage detected