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

Function TestLoginSetsGitProtocolForProvidedHost

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

Source from the content-addressed store, hash-verified

330}
331
332func TestLoginSetsGitProtocolForProvidedHost(t *testing.T) {
333 // Given we are logged in
334 authCfg := newTestAuthConfig(t)
335 _, err := authCfg.Login("github.com", "test-user", "test-token", "ssh", false)
336 require.NoError(t, err)
337
338 // When we get the host git protocol
339 hostProtocol, err := authCfg.cfg.Get([]string{hostsKey, "github.com", gitProtocolKey})
340 require.NoError(t, err)
341
342 // Then it returns the git protocol we provided on login
343 require.Equal(t, "ssh", hostProtocol)
344}
345
346func TestLoginAddsHostIfNotAlreadyAdded(t *testing.T) {
347 // Given we are logged in

Callers

nothing calls this directly

Calls 4

newTestAuthConfigFunction · 0.85
EqualMethod · 0.80
LoginMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected