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

Function TestLoginSetsGitProtocolForProvidedHost

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

Source from the content-addressed store, hash-verified

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