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

Function TestDefaultHostLoggedInToOnlyOneHost

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

Source from the content-addressed store, hash-verified

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