MCPcopy Create free account
hub / github.com/cli/cli / TestDefaultHostLoggedInToOnlyOneHost

Function TestDefaultHostLoggedInToOnlyOneHost

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

Source from the content-addressed store, hash-verified

236}
237
238func TestDefaultHostLoggedInToOnlyOneHost(t *testing.T) {
239 // Given we are logged into one host (not github.com to differentiate from the fallback)
240 authCfg := newTestAuthConfig(t)
241 _, err := authCfg.Login("ghe.io", "test-user", "test-token", "", false)
242 require.NoError(t, err)
243
244 // When we get the DefaultHost
245 defaultHost, source := authCfg.DefaultHost()
246
247 // Then the returned host is that logged in host and the source is the hosts config
248 require.Equal(t, "ghe.io", defaultHost)
249 require.Equal(t, hostsKey, source)
250}
251
252func TestLoginSecureStorageUsesKeyring(t *testing.T) {
253 // 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