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

Function TestLoginSetsGitProtocolForProvidedHost

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

Source from the content-addressed store, hash-verified

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