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

Function TestDefaultHostLoggedInToOnlyOneHost

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

Source from the content-addressed store, hash-verified

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