MCPcopy Index your code
hub / github.com/cli/cli / TestLoginSetsGitProtocolForProvidedHost

Function TestLoginSetsGitProtocolForProvidedHost

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

Source from the content-addressed store, hash-verified

316}
317
318func TestLoginSetsGitProtocolForProvidedHost(t *testing.T) {
319 // Given we are logged in
320 authCfg := newTestAuthConfig(t)
321 _, err := authCfg.Login("github.com", "test-user", "test-token", "ssh", false)
322 require.NoError(t, err)
323
324 // When we get the host git protocol
325 hostProtocol, err := authCfg.cfg.Get([]string{hostsKey, "github.com", gitProtocolKey})
326 require.NoError(t, err)
327
328 // Then it returns the git protocol we provided on login
329 require.Equal(t, "ssh", hostProtocol)
330}
331
332func TestLoginAddsHostIfNotAlreadyAdded(t *testing.T) {
333 // 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